API Overview and Authentication
The public API reads a merchant's services, staff, appointments, customers, payments, and refunds. For fields, see Resources and Fields. For list parameters, see Pagination and Filtering. For the error format, see Errors and Rate Limits.
Request format
| Item | Value |
|---|---|
| Base URL | https://api.dolyu.com/v1 |
| Method | GET |
| Authentication header | Authorization: Bearer <API key> |
| Response | JSON |
| Response header | X-Request-Id: the ID of this request, the same as request_id in an error body |
Other methods return 405 method_not_allowed.
API keys
- Keys start with
dolyu_sk_. - Owners and admins create and revoke keys in the dashboard. Each merchant can have up to 5 keys. For the steps, permissions, and expiration, see API Keys.
- The full key is shown only once, when it is created.
- You can set an expiration date when creating a key. A revoked or expired key returns 401
invalid_api_key. - Send the key only in the
Authorizationheader. If a key appears in the URL or in any other header (exceptCookieandProxy-Authorization) of aGETrequest, it is revoked immediately and the request returns 401api_key_exposed. - A key can only read data of the merchant that created it.
Permissions
Select at least one permission when creating a key.
| Permission | Endpoints |
|---|---|
| No permission needed | GET /merchant |
catalog:read | GET /services, GET /services/{id}, GET /staff, GET /staff/{id} |
appointments:read | GET /appointments, GET /appointments/{id} |
customers:read | GET /customers, GET /customers/{id} |
payments:read | GET /payments, GET /payments/{id}, GET /refunds, GET /refunds/{id} |
| Any one of the four permissions above | GET /events, GET /events/{id} |
- If a key lacks the permission an endpoint requires, the request returns 403
insufficient_permission. - The event types the event endpoints return depend on the key's permissions. See Events.
- If a key lacks
customers:read, thecustomerin an appointment contains onlyidandobject. See Resources and Fields.
Endpoints
| Method and path | Returns |
|---|---|
GET /merchant | The merchant the key belongs to |
GET /services | List of services |
GET /services/{id} | A service |
GET /staff | List of staff members |
GET /staff/{id} | A staff member |
GET /appointments | List of appointments |
GET /appointments/{id} | An appointment |
GET /customers | List of customers |
GET /customers/{id} | A customer |
GET /payments | List of payments |
GET /payments/{id} | A payment |
GET /refunds | List of refunds |
GET /refunds/{id} | A refund |
GET /events | List of events. See Events |
GET /events/{id} | An event |
OpenAPI
An OpenAPI 3.1 description of the endpoints, response fields, and webhook events: https://docs.dolyu.com/openapi/v1.json
Example
bash
curl https://api.dolyu.com/v1/merchant \
-H "Authorization: Bearer dolyu_sk_..."json
{
"id": "0198c5f0-0000-7000-8000-000000000001",
"object": "merchant",
"name": "Sample Studio",
"slug": "example-studio",
"timezone": "Asia/Taipei",
"currency": "TWD",
"locale": "zh_TW"
}Implementation checklist
- Skip response fields you don't recognize.
- Read lists page by page with
next_cursoruntilhas_moreisfalse. See Pagination and Filtering. - On 429, wait the number of seconds in
Retry-After, then retry. See Errors and Rate Limits. - When polling for changed appointments or customers with
updated_at[gte], start from a time earlier than when your previous query began, and overwrite records you already have byid.