This quickstart creates an Access Token and uses it to make a read-only request to the 3Chat API.
Create or open an application in 3Chat Open Platform. Copy the application's App Key and App Secret.
Store both values in a secure server-side environment. The App Secret must never be included in browser or mobile application code.
Send the App Key and App Secret to the token endpoint:
curl --request POST \
--url 'https://app.3chat.ai/api/open/v3/token' \
--header 'content-type: application/json' \
--data '{
"body": {
"appKey": "your_app_key",
"appSecret": "your_app_secret"
}
}'A successful response contains an Access Token, a Refresh Token, and their expiration values:
{
"code": 0,
"message": "",
"data": {
"entity": {
"accessToken": "your_access_token",
"accessTokenExpireIn": 0,
"refreshToken": "your_refresh_token",
"refreshTokenExpireIn": 0
}
}
}Use the expiration values returned by the API. The zero values above only illustrate the response structure.
Send the Access Token in the Authorization header:
curl --request POST \
--url 'https://app.3chat.ai/api/open/v3/currentStaff/query' \
--header 'authorization: Bearer your_access_token' \
--header 'content-type: application/json'The request is successful when the API returns a success code and the current staff member in data.entity.
Before the Access Token expires, exchange the Refresh Token for a new token pair:
curl --request PUT \
--url 'https://app.3chat.ai/api/open/v3/token' \
--header 'content-type: application/json' \
--data '{
"body": {
"refreshToken": "your_refresh_token"
}
}'If the Refresh Token has expired, call the Create Access Token endpoint again with the App Key and App Secret.
- Read the API overview for authentication, request conventions, resource groups, and error handling.
- Open the Authentication API group in the API Reference for the complete token lifecycle.
- Explore API groups such as Agent, Dialog, Visitor, and Conversation.
- Read the Webhooks overview before subscribing to events.