Masko AI Authentication API

The Authentication API from Masko AI — 5 operation(s) for authentication.

GitHub OpenAPI

Operations 5

POST /v1/auth/device Start device authorization for Masko CLI (remote terminals) #
POST /v1/auth/token Exchange a PKCE authorization code, poll a device code, or rotate a CLI refresh… #
POST /v1/auth/revoke End a CLI browser session using its refresh token #
GET /v1/auth/session Identify the account, workspace, and credential in use #
GET /v1/auth/config Discover Masko CLI browser authorization #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/masko-ai:masko-ai-authentication-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

masko-ai-authentication-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Masko Authentication API
  version: '2026-09-26'
  description: 'API for generating and managing AI mascots, animations, and logos. The current API version is the date in `info.version`; send it as the Masko-API-Version header, and every response echoes the version it used plus a Request-Id. JSON resource responses use {data, meta?} / {error: {code, message, param?, details?, doc_url, request_id}} envelopes. Standard authenticated resource POSTs accept Idempotency-Key for safe retries (auth and admin routes excluded), and lists return meta.pagination.next_cursor. Resources carry an object field naming their type; docs and OpenAPI are served directly and 204 responses have no body. Generation endpoints return 202 with endpoint-specific receipts: individual jobs use job_id and poll_url, developer orchestration uses run_id, and batch operations list their jobs. See each operation for its polling contract. Protected requests accept API keys or scoped CLI session access tokens. Amounts are in credits, and one credit is $0.125: every credit amount in a response comes with the same amount in US dollars, named like it plus _usd (estimated_cost_usd beside estimated_cost).'
servers:
- url: https://api.masko.ai
  description: Production
- url: http://localhost:3000/api
  description: Local development
security:
- BearerAuth: []
tags:
- name: Authentication
paths:
  /v1/auth/device:
    post:
      operationId: createCLIDeviceGrant
      tags:
      - Authentication
      summary: Start device authorization for Masko CLI (remote terminals)
      description: No bearer required. Show user_code and verification_uri_complete, then poll auth/token at interval seconds. Codes expire after 600 seconds. Explicit signed-in browser approval selects the workspace. Uses the Masko JSON envelope and device-grant semantics, not form-encoded OAuth transport.
      security: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                client_id:
                  type: string
                  enum:
                  - masko-cli
                device_name:
                  type: string
                  minLength: 1
                  maxLength: 100
                  pattern: ^[^\u0000-\u001f\u007f]+$
                scope:
                  type: string
                  enum:
                  - read
                  - write
                  default: write
              required:
              - client_id
              - device_name
              additionalProperties: false
      responses:
        '200':
          description: 'Success. Cache-Control: no-store.'
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      device_code:
                        type: string
                      user_code:
                        type: string
                      verification_uri:
                        type: string
                        format: uri
                      verification_uri_complete:
                        type: string
                        format: uri
                      expires_in:
                        type: number
                      interval:
                        type: number
                    required:
                    - device_code
                    - user_code
                    - verification_uri
                    - verification_uri_complete
                    - expires_in
                    - interval
                required:
                - data
          headers:
            Request-Id:
              description: Unique ID of this request. Include it when contacting support.
              schema:
                type: string
                example: req_3f9c2a71d0b84e6a9c1f5e22
            Masko-API-Version:
              description: API version used to build this response.
              schema:
                type: string
                example: '2026-09-26'
        '400':
          description: Validation or device-grant state error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
          headers:
            Request-Id:
              description: Unique ID of this request. Include it when contacting support.
              schema:
                type: string
                example: req_3f9c2a71d0b84e6a9c1f5e22
            Masko-API-Version:
              description: API version used to build this response.
              schema:
                type: string
                example: '2026-09-26'
        '429':
          description: Rate limited.
          headers:
            Request-Id:
              description: Unique ID of this request. Include it when contacting support.
              schema:
                type: string
                example: req_3f9c2a71d0b84e6a9c1f5e22
            Masko-API-Version:
              description: API version used to build this response.
              schema:
                type: string
                example: '2026-09-26'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '503':
          description: Authentication service unavailable.
          headers:
            Request-Id:
              description: Unique ID of this request. Include it when contacting support.
              schema:
                type: string
                example: req_3f9c2a71d0b84e6a9c1f5e22
            Masko-API-Version:
              description: API version used to build this response.
              schema:
                type: string
                example: '2026-09-26'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
  /v1/auth/token:
    post:
      operationId: exchangeCLIToken
      tags:
      - Authentication
      summary: Exchange a PKCE authorization code, poll a device code, or rotate a CLI refresh…
      description: 'No bearer required. For authorization_code, send code, exact redirect_uri, and the original code_verifier; S256 must match the approved challenge. Codes expire after 120 seconds and are single-use. For device grants: authorization_pending: continue polling; slow_down: add 5 seconds to every subsequent interval; access_denied, expired_token, invalid_grant: stop. Access tokens last 900 seconds. Refresh tokens rotate once per use; reuse revokes the session. Serialize refreshes and save the returned pair atomically. Sessions expire after 90 days. Never log tokens.'
      security: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              oneOf:
              - type: object
                properties:
                  client_id:
                    type: string
                    enum:
                    - masko-cli
                  grant_type:
                    type: string
                    enum:
                    - authorization_code
                  code:
                    type: string
                    pattern: ^masko_ac_[a-f0-9]{64}$
                  redirect_uri:
                    type: string
                    maxLength: 200
                    format: uri
                  code_verifier:
                    type: string
                    pattern: ^[A-Za-z0-9._~-]{43,128}$
                required:
                - client_id
                - grant_type
                - code
                - redirect_uri
                - code_verifier
                additionalProperties: false
              - type: object
                properties:
                  client_id:
                    type: string
                    enum:
                    - masko-cli
                  grant_type:
                    type: string
                    enum:
                    - urn:ietf:params:oauth:grant-type:device_code
                  device_code:
                    type: string
                    pattern: ^masko_dc_[a-f0-9]{64}$
                required:
                - client_id
                - grant_type
                - device_code
                additionalProperties: false
              - type: object
                properties:
                  client_id:
                    type: string
                    enum:
                    - masko-cli
                  grant_type:
                    type: string
                    enum:
                    - refresh_token
                  refresh_token:
                    type: string
                    pattern: ^masko_rt_[a-f0-9]{64}$
                required:
                - client_id
                - grant_type
                - refresh_token
                additionalProperties: false
      responses:
        '200':
          description: 'Success. Cache-Control: no-store.'
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      access_token:
                        type: string
                      refresh_token:
                        type: string
                      token_type:
                        type: string
                        enum:
                        - Bearer
                      expires_in:
                        type: number
                      session_id:
                        type: string
                        format: uuid
                      session_expires_at:
                        type: string
                    required:
                    - access_token
                    - refresh_token
                    - token_type
                    - expires_in
                    - session_id
                    - session_expires_at
                required:
                - data
          headers:
            Request-Id:
              description: Unique ID of this request. Include it when contacting support.
              schema:
                type: string
                example: req_3f9c2a71d0b84e6a9c1f5e22
            Masko-API-Version:
              description: API version used to build this response.
              schema:
                type: string
                example: '2026-09-26'
        '400':
          description: Validation or device-grant state error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
          headers:
            Request-Id:
              description: Unique ID of this request. Include it when contacting support.
              schema:
                type: string
                example: req_3f9c2a71d0b84e6a9c1f5e22
            Masko-API-Version:
              description: API version used to build this response.
              schema:
                type: string
                example: '2026-09-26'
        '429':
          description: Rate limited.
          headers:
            Request-Id:
              description: Unique ID of this request. Include it when contacting support.
              schema:
                type: string
                example: req_3f9c2a71d0b84e6a9c1f5e22
            Masko-API-Version:
              description: API version used to build this response.
              schema:
                type: string
                example: '2026-09-26'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '503':
          description: Authentication service unavailable.
          headers:
            Request-Id:
              description: Unique ID of this request. Include it when contacting support.
              schema:
                type: string
                example: req_3f9c2a71d0b84e6a9c1f5e22
            Masko-API-Version:
              description: API version used to build this response.
              schema:
                type: string
                example: '2026-09-26'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
  /v1/auth/revoke:
    post:
      operationId: revokeCLISession
      tags:
      - Authentication
      summary: End a CLI browser session using its refresh token
      description: Idempotent. Ends access immediately. Does not revoke API keys or other installations.
      security: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                refresh_token:
                  type: string
                  pattern: ^masko_rt_[a-f0-9]{64}$
              required:
              - refresh_token
              additionalProperties: false
      responses:
        '200':
          description: 'Success. Cache-Control: no-store.'
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      revoked:
                        type: boolean
                    required:
                    - revoked
                required:
                - data
          headers:
            Request-Id:
              description: Unique ID of this request. Include it when contacting support.
              schema:
                type: string
                example: req_3f9c2a71d0b84e6a9c1f5e22
            Masko-API-Version:
              description: API version used to build this response.
              schema:
                type: string
                example: '2026-09-26'
        '400':
          description: Validation or device-grant state error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
          headers:
            Request-Id:
              description: Unique ID of this request. Include it when contacting support.
              schema:
                type: string
                example: req_3f9c2a71d0b84e6a9c1f5e22
            Masko-API-Version:
              description: API version used to build this response.
              schema:
                type: string
                example: '2026-09-26'
        '429':
          description: Rate limited.
          headers:
            Request-Id:
              description: Unique ID of this request. Include it when contacting support.
              schema:
                type: string
                example: req_3f9c2a71d0b84e6a9c1f5e22
            Masko-API-Version:
              description: API version used to build this response.
              schema:
                type: string
                example: '2026-09-26'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '503':
          description: Authentication service unavailable.
          headers:
            Request-Id:
              description: Unique ID of this request. Include it when contacting support.
              schema:
                type: string
                example: req_3f9c2a71d0b84e6a9c1f5e22
            Masko-API-Version:
              description: API version used to build this response.
              schema:
                type: string
                example: '2026-09-26'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
  /v1/auth/session:
    get:
      operationId: getAuthSession
      tags:
      - Authentication
      summary: Identify the account, workspace, and credential in use
      security:
      - BearerAuth: []
      responses:
        '200':
          description: Authenticated identity.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      user_id:
                        type: string
                        format: uuid
                      email:
                        type: string
                      organization_id:
                        type:
                        - string
                        - 'null'
                        format: uuid
                      organization_name:
                        type:
                        - string
                        - 'null'
                        description: The team workspace name; null for a personal workspace.
                      permissions:
                        type: string
                        enum:
                        - read
                        - write
                        - admin
                      method:
                        type: string
                        enum:
                        - browser
                        - oauth
                        - api_key
                        description: 'How the credential was issued: browser for a masko CLI sign-in, oauth for an app signed in through Masko OAuth (such as an MCP client), api_key for an API key.'
                      session_id:
                        type:
                        - string
                        - 'null'
                        format: uuid
                    required:
                    - user_id
                    - organization_id
                    - organization_name
                    - permissions
                    - method
                    - session_id
                required:
                - data
          headers:
            Request-Id:
              description: Unique ID of this request. Include it when contacting support.
              schema:
                type: string
                example: req_3f9c2a71d0b84e6a9c1f5e22
            Masko-API-Version:
              description: API version used to build this response.
              schema:
                type: string
                example: '2026-09-26'
        '401':
          description: Expired, revoked, or missing credential.
          headers:
            Request-Id:
              description: Unique ID of this request. Include it when contacting support.
              schema:
                type: string
                example: req_3f9c2a71d0b84e6a9c1f5e22
            Masko-API-Version:
              description: API version used to build this response.
              schema:
                type: string
                example: '2026-09-26'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '403':
          description: Restricted credential.
          headers:
            Request-Id:
              description: Unique ID of this request. Include it when contacting support.
              schema:
                type: string
                example: req_3f9c2a71d0b84e6a9c1f5e22
            Masko-API-Version:
              description: API version used to build this response.
              schema:
                type: string
                example: '2026-09-26'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '503':
          description: Account unavailable.
          headers:
            Request-Id:
              description: Unique ID of this request. Include it when contacting support.
              schema:
                type: string
                example: req_3f9c2a71d0b84e6a9c1f5e22
            Masko-API-Version:
              description: API version used to build this response.
              schema:
                type: string
                example: '2026-09-26'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
      description: Returns the account, workspace and credential that authenticated this request. Use it to check which key an integration is using.
  /v1/auth/config:
    get:
      operationId: getCLIAuthConfig
      tags:
      - Authentication
      summary: Discover Masko CLI browser authorization
      security: []
      description: The registered masko-cli client opens authorization_endpoint with response_type=code, client_id=masko-cli, device_name, scope read/write, redirect_uri, state, code_challenge, and code_challenge_method=S256. Only http://127.0.0.1:PORT/oauth/callback with port 1024..65535 is accepted. Use independent random verifier and state values with at least 32 random bytes; state is echoed and must be checked by the CLI. Browser sign-in and explicit workspace approval return a one-time code, never access or refresh tokens. This is Masko JSON transport, not general OAuth server discovery.
      responses:
        '200':
          description: 'Configuration. Cache-Control: no-store.'
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      authorization_endpoint:
                        type: string
                        format: uri
                      code_challenge_methods_supported:
                        type: array
                        items:
                          type: string
                          enum:
                          - S256
                      grant_types_supported:
                        type: array
                        items:
                          type: string
                          enum:
                          - authorization_code
                          - urn:ietf:params:oauth:grant-type:device_code
                          - refresh_token
                    required:
                    - authorization_endpoint
                    - code_challenge_methods_supported
                    - grant_types_supported
                required:
                - data
          headers:
            Request-Id:
              description: Unique ID of this request. Include it when contacting support.
              schema:
                type: string
                example: req_3f9c2a71d0b84e6a9c1f5e22
            Masko-API-Version:
              description: API version used to build this response.
              schema:
                type: string
                example: '2026-09-26'
components:
  schemas:
    ApiError:
      type: object
      required:
      - error
      properties:
        error:
          type: object
          required:
          - code
          - message
          - doc_url
          - request_id
          properties:
            code:
              type: string
              description: Stable machine-readable code. Switch on this.
            message:
              type: string
              description: Human-readable explanation.
            param:
              type: string
              description: The request field that caused the error, when there is one.
            details:
              type: object
              additionalProperties: true
              description: Extra context, for example issues for validation errors, or required and balance for credits with their required_usd and balance_usd.
            doc_url:
              type: string
              format: uri
              description: Documentation for this error code.
            request_id:
              type: string
              description: Same value as the Request-Id header. Include it when contacting support.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: API key (masko_<key>) or short-lived CLI session access token (masko_at_<token>). Send as Bearer. Projects, mascots and their assets, independent canvases and jobs are scoped to the credential workspace. Cross-workspace resource IDs return 404; select another workspace with browser login or use a key issued for that workspace. Collection routes remain legacy aliases; the separate character registry is retired.
    AppKeyInLink:
      type: apiKey
      in: query
      name: key
      description: 'An app key (masko_app_<key>) inside the canvas link, so one link is all an app needs: https://api.masko.ai/v1/canvases/{canvasId}/delivery?key=masko_app_... Only the canvas delivery and bundle endpoints read it, and only app keys: an API key is never read from a link. When an Authorization header also holds a key, the header wins.'
x-tagGroups:
- name: Mascot
  tags:
  - Mascots
  - Collections
  - Items
  - Assets
  - References
  - Voice
  - Sounds
  - Settings
- name: Creating content
  tags:
  - Generate
  - Canvases
- name: Platform
  tags:
  - Projects
  - Jobs
  - Webhooks
  - Credits
  - Styles
  - Upload
  - Analyze
  - Feedback