Config API
Config API allows you to get shop configuration: name, language, bot settings. Use it to customize your UI.
GET/api/v1/config
Get Configuration
Returns basic configuration of the shop linked to the API token.
Response
- Name
shop_id- Type
- integer
- Description
- Shop ID
- Name
shop_name- Type
- string
- Description
- Shop name
- Name
language- Type
- string
- Description
- Shop language (`ru` or `en`)
- Name
bot_name- Type
- string
- Description
- AI bot name (can be `null`)
- Name
bot_avatar_url- Type
- string
- Description
- Bot avatar URL (can be `null`)
Request
curl "https://api.parsewise.ru/v1/config" \
-H "Authorization: Bearer pw_your_token"
Response
{
"shop_id": 123,
"shop_name": "My Shop",
"language": "en",
"bot_name": "AI Consultant",
"bot_avatar_url": "https://cdn.parsewise.ru/avatars/bot-123.jpg"
}
Using Configuration
UI Setup Based on Configuration
import { useEffect, useState } from 'react'
function ChatWidget() {
const [config, setConfig] = useState(null)
useEffect(() => {
fetch('https://api.parsewise.ru/v1/config', {
headers: { 'Authorization': 'Bearer pw_token' }
})
.then(res => res.json())
.then(setConfig)
}, [])
if (!config) return <div>Loading...</div>
return (
<div className="chat-widget">
<header>
{config.bot_avatar_url && (
<img src={config.bot_avatar_url} alt="Bot" />
)}
<h3>{config.bot_name || 'AI Consultant'}</h3>
</header>
{/* ... rest of UI ... */}
</div>
)
}
Token Verification
The `/config` endpoint is the simplest way to verify token validity:def is_token_valid(token):
try:
response = requests.get(
"https://api.parsewise.ru/v1/config",
headers={"Authorization": f"Bearer {token}"},
timeout=5
)
return response.status_code == 200
except:
return False
Shop settings (name, language, bot) can be changed in the admin panel in shop settings.