API docs

Issue a token

Exchanges an API key for a 1-hour token. This is the only endpoint that doesn't require authentication — the key itself is the credential.

Version: v1

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

Token issuance parameters
NameCategoryDescription
api_keyRequiredThe plaintext key issued in the app. It starts with mc_live_
workspaceRequiredCode of the workspace this token will work with. Same as the code in the app URL /app/w/{code}

1.3 Request

Terminal — bash
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

Response — JSON
{
    "result": "SUCCESS",
    "result_code": 0,
    "data": {
        "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
        "token_type": "Bearer",
        "expires_in": 3600,
        "workspace": "a1b2c3d4"
    }
}

1.5 Field

Token issuance fields
FieldTypeDescription
access_tokenstringSend as is in Authorization: Bearer on subsequent calls
token_typestringAlways Bearer
expires_inintRemaining lifetime (seconds). Currently 3600
workspacestringCode of the workspace this token can work with

1.6 Failed

Token issuance failures
CodeHTTPWhen
1001401The key doesn't exist, has been revoked, or can't access that workspace. We don't say which
9912400api_key or workspace was not provided
4290429Exceeded 30 per minute