Authentication
All requests to Parsewise API require authentication with a Bearer token. Tokens are created in the admin panel and have different access levels.
Getting a Token
1. Log in to admin panel2. Select a shop
3. Go to API section in sidebar
4. Click Create Token
5. Enter a name and select a role
6. Important: copy the token immediately — it's shown only once
Using the Token
Add the token to the Authorization header of each request:
Authorization: Bearer pw_xxxxxxxxxxxxxxxxxxxxx
curl "https://api.parsewise.ru/v1/config" \
-H "Authorization: Bearer pw_your_token"
Token Roles
Tokens have different access levels depending on the role:| Role | Description | Available Endpoints |
|---|---|---|
| Viewer | Reading and using AI | /chat, /search, /products (GET), /config |
| Editor | Product management | All Viewer rights + /products (POST, PUT, DELETE) |
| Admin | Full access | Reserved for future use |
We recommend using **Viewer** role for frontend integrations and **Editor** for backend product synchronization.
Token Security
Storage
- Never store tokens in client-side code (JavaScript in browser)- Use environment variables on the server
- For frontend, create a proxy on your backend
Rotation
- Periodically create new tokens and delete old ones- If a token is leaked, immediately delete it in the admin panel
Tracking
In the admin panel you can see: - When the token was last used- Who created the token
- Change history
Authentication Errors
| Code | Reason | Solution |
|---|---|---|
401 Unauthorized | Token is missing or invalid | Check format: Bearer pw_xxx |
403 Forbidden | Insufficient permissions | Use token with required role |
401 Error Example
{
"detail": "Invalid API token"
}
403 Error Example
{
"detail": "This endpoint requires EDITOR role or higher"
}
Example: Token Verification
The simplest way to verify a token is to request the shop configuration:curl "https://api.parsewise.ru/v1/config" \
-H "Authorization: Bearer pw_your_token"
{
"shop_id": 123,
"shop_name": "My Shop",
"language": "en",
"bot_name": "AI Consultant",
"bot_avatar_url": "https://..."
}