01 Issue a token
1.1 Description
POST/auth/token
Even if a key can reach several workspaces, a single token works only for the one you chose when issuing it. To work with another workspace, get a new token with that workspace's code.
1.2 Parameters
| Name | Category | Description |
|---|---|---|
api_key | Required | The plaintext key issued in the app. It starts with mc_live_ |
workspace | Required | Code of the workspace this token will work with. Same as the code in the app URL /app/w/{code} |
1.3 Request
curl -X POST https://moacast.com/api/moacast/v1/auth/token \
-H 'Content-Type: application/json' \
-d '{"api_key":"mc_live_xxxxxxxxxxxx","workspace":"a1b2c3d4"}'1.4 Success response
{
"result": "SUCCESS",
"result_code": 0,
"data": {
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
"token_type": "Bearer",
"expires_in": 3600,
"workspace": "a1b2c3d4"
}
}1.5 Field
| Field | Type | Description |
|---|---|---|
access_token | string | Send as is in Authorization: Bearer on subsequent calls |
token_type | string | Always Bearer |
expires_in | int | Remaining lifetime (seconds). Currently 3600 |
workspace | string | Code of the workspace this token can work with |
1.6 Failed
| Code | HTTP | When |
|---|---|---|
1001 | 401 | The key doesn't exist, has been revoked, or can't access that workspace. We don't say which |
9912 | 400 | api_key or workspace was not provided |
4290 | 429 | Exceeded 30 per minute |
