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 panel
2. 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:
RoleDescriptionAvailable Endpoints
ViewerReading and using AI/chat, /search, /products (GET), /config
EditorProduct managementAll Viewer rights + /products (POST, PUT, DELETE)
AdminFull accessReserved for future use

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

CodeReasonSolution
401 UnauthorizedToken is missing or invalidCheck format: Bearer pw_xxx
403 ForbiddenInsufficient permissionsUse 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"
Successful response:
{
  "shop_id": 123,
  "shop_name": "My Shop",
  "language": "en",
  "bot_name": "AI Consultant",
  "bot_avatar_url": "https://..."
}

Was this page helpful?