Sanka exposes workspace-scoped REST endpoints. Tokens you generate carry your workspace_id and are used as Bearer JWTs across all endpoints.
Sign in to the app and open Developers → API.
Click Create Token, choose Full Access (POST+GET) or Regular (GET only), then save.
Copy the Access Token (shown once) and Refresh Token to a safe place.
https://api.sanka.com/v1
Local dev: http://app.localhost:8000/
All endpoints use:
```
Authorization: Bearer <access_token>
```
Refresh: POST /api/token/refresh/ with body { "refresh": "" }.
List orders:
```bash
curl -X GET \
"https://api.sanka.com/v1/orders/?page=1&amount=30" \
-H "Authorization: Bearer <access_token>"
```
List items:
```bash
curl -X GET \
"https://api.sanka.com/v1/items" \
-H "Authorization: Bearer <access_token>"
```
List contacts + companies:
```bash
curl -X GET \
"https://api.sanka.com/v1/contacts" \
-H "Authorization: Bearer <access_token>"
```
Create a subscription:
```bash
curl -X POST \
"https://api.sanka.com/v1/subscriptions/create" \
-H "Authorization: Bearer <access_token>" \
-H "Content-Type: application/json" \
-d '{ "cid": "<contact_or_company_id>", "subscription_status": "active", "items": [{ "id": "<item_id>", "amount": 1 }], "currency": "JPY" }'
```
Create an invoice:
```bash
curl -X POST \
"https://api.sanka.com/v1/invoices/create" \
-H "Authorization: Bearer <access_token>" \
-H "Content-Type: application/json" \
-d '{ "cid": "<contact_or_company_id>", "status": "scheduled", "items": [{ "id": "<item_id>", "amount": 1 }], "currency": "JPY" }'
```
Refresh your token:
```bash
curl -X POST \
"https://api.sanka.com/api/token/refresh/" \
-H "Content-Type: application/json" \
-d '{ "refresh": "<refresh_token>" }'
```
Open the Developers tab and use the OpenAPI-backed API Reference. Set Authorization: Bearer when trying any endpoint.