TikTok for Developers · API Governance Rules

TikTok for Developers API Rules

Spectral linting rules defining API design standards and conventions for TikTok for Developers.

9 Rules error 3 warn 5 info 1
View Rules File View on GitHub

Rule Categories

tiktok

Rules

warn
tiktok-operation-id-camel-case
Operation IDs must use camelCase
$.paths[*][*].operationId
warn
tiktok-path-trailing-slash
TikTok API paths must end with a trailing slash
$.paths
error
tiktok-versioned-paths
All paths must include an API version prefix
$.paths
error
tiktok-bearer-auth
All operations must use Bearer authentication
$.paths[*][*]
warn
tiktok-response-data-wrapper
Successful responses should wrap data in a data envelope
$.paths[*][*].responses.200.content.application/json.schema.properties
warn
tiktok-error-object
Successful responses should include an error object for consistent error signaling
$.paths[*][*].responses.200.content.application/json.schema.properties
error
tiktok-operation-summary-present
All operations must have a summary
$.paths[*][*]
warn
tiktok-operation-tags
All operations must have at least one tag
$.paths[*][*]
info
tiktok-fields-query-param
GET and POST endpoints that return data should support a fields query parameter
$.paths[*][get,post].parameters[*]

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:
  tiktok-operation-id-camel-case:
    description: Operation IDs must use camelCase
    message: "Operation ID '{{value}}' must use camelCase"
    severity: warn
    given: "$.paths[*][*].operationId"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]*$"

  tiktok-path-trailing-slash:
    description: TikTok API paths must end with a trailing slash
    message: "Path '{{path}}' must end with a trailing slash per TikTok API convention"
    severity: warn
    given: "$.paths"
    then:
      field: "@key"
      function: pattern
      functionOptions:
        match: ".*/$"

  tiktok-versioned-paths:
    description: All paths must include an API version prefix
    message: "Path '{{value}}' must start with /v2/ version prefix"
    severity: error
    given: "$.paths"
    then:
      field: "@key"
      function: pattern
      functionOptions:
        match: "^/v[0-9]+/"

  tiktok-bearer-auth:
    description: All operations must use Bearer authentication
    message: "Operation must use BearerAuth security scheme"
    severity: error
    given: "$.paths[*][*]"
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          properties:
            security:
              type: array
          required:
            - security

  tiktok-response-data-wrapper:
    description: Successful responses should wrap data in a data envelope
    message: "Response 200 schema should have a 'data' property"
    severity: warn
    given: "$.paths[*][*].responses.200.content.application/json.schema.properties"
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          required:
            - data

  tiktok-error-object:
    description: Successful responses should include an error object for consistent error signaling
    message: "Response 200 schema should include an 'error' property"
    severity: warn
    given: "$.paths[*][*].responses.200.content.application/json.schema.properties"
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          required:
            - error

  tiktok-operation-summary-present:
    description: All operations must have a summary
    message: "Operation must have a summary"
    severity: error
    given: "$.paths[*][*]"
    then:
      field: summary
      function: truthy

  tiktok-operation-tags:
    description: All operations must have at least one tag
    message: "Operation must have at least one tag"
    severity: warn
    given: "$.paths[*][*]"
    then:
      field: tags
      function: truthy

  tiktok-fields-query-param:
    description: GET and POST endpoints that return data should support a fields query parameter
    message: "Endpoint should support a 'fields' query parameter for field selection"
    severity: info
    given: "$.paths[*][get,post].parameters[*]"
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          properties:
            name:
              type: string

Work with this as data

Every ruleset 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 spectral rules

4 MCP tools reach this
  • find_rulesBrowse and filter every ruleset in the catalog.
  • 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 ruleset
curl "https://apis.io/api/v1/rules/tiktok-for-developers-rules"
All spectral rules
curl "https://apis.io/api/v1/rules?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no email required.

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