Tweetsmash Labels API

Create, apply and remove labels.

GitHub OpenAPI

Operations 5

GET /labels Manage Labels #
POST /labels/add Add Labels to Tweets #
POST /labels/remove Remove Labels from Tweets #
POST /labels/add-by-filter Add Labels by Filter (bulk) #
POST /labels/batch Apply many label operations in one request #

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/tweetsmash-com:tweetsmash-com-labels-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

tweetsmash-com-labels-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Tweetsmash Labels API
  version: 1.0.0
  summary: Read, label, filter and export your saved X (Twitter) posts.
  description: 'The Tweetsmash REST API returns the X (Twitter) posts a user has saved to Tweetsmash, as JSON with unrolled threads and labels, and lets a caller label, filter and export them.


    It reads only the authenticated account''s own saved posts. It cannot search public X, and it cannot post, reply, like or follow.


    Authentication is a Bearer API key created at https://www.tweetsmash.com/integrations/api. See https://www.tweetsmash.com/auth.md.


    The same account is also reachable over the Model Context Protocol at https://mcp.tweetsmash.com/api/mcp — see https://www.tweetsmash.com/.well-known/mcp/server-card.json.


    Versioning: the version lives in the path (/v1). Inside a version we will not remove or rename a field, change a field''s type, remove an endpoint, or add a required parameter. New fields, new optional parameters, new error codes and new enum values are non-breaking and can appear at any time. A deprecated endpoint keeps working and starts answering with Deprecation and Sunset headers plus a Link rel="deprecation" pointing at the replacement, with at least 180 days between the two dates. See https://www.tweetsmash.com/developers#versioning.'
  termsOfService: https://www.tweetsmash.com/terms
  contact:
    name: Tweetsmash Support
    email: support@tweetsmash.com
    url: https://www.tweetsmash.com/contact
  license:
    name: Proprietary
    url: https://www.tweetsmash.com/terms
servers:
- url: https://api.tweetsmash.com/v1
  description: Production. Reads and writes the authenticated account.
- url: https://api.tweetsmash.com/v1/sandbox
  description: Sandbox. Same shapes, fixture data, no API key required. Reads and writes nothing. Send X-Tweetsmash-Sandbox-Error to force a specific failure.
security:
- bearerAuth: []
tags:
- name: Labels
  description: Create, apply and remove labels.
paths:
  /labels:
    get:
      operationId: ManageLabels
      summary: Manage Labels
      description: Retrieve all labels associated with your account and their usage counts.
      externalDocs:
        description: Endpoint documentation
        url: https://www.tweetsmash.com/api-docs/manage-labels
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponse'
              example:
                status: true
                data:
                - id: '1672516100'
                  label_name: 80/20 rule
                  metadata: null
                  count: 1
                - id: '1777369802782155300'
                  label_name: AI
                  metadata: null
                  count: 285
                - id: '1672512785'
                  label_name: Advertisement
                  metadata: null
                  count: 1
        '401':
          description: Missing, malformed or revoked API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                status: false
                code: UNAUTHORIZED
                error: ''
                message: Unauthorized
        '402':
          $ref: '#/components/responses/PaymentRequired'
      tags:
      - Labels
      parameters:
      - $ref: '#/components/parameters/SandboxError'
  /labels/add:
    post:
      operationId: AddLabels
      summary: Add Labels to Tweets
      description: Add labels to specific tweets to organize your bookmarks.
      externalDocs:
        description: Endpoint documentation
        url: https://www.tweetsmash.com/api-docs/add-labels
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponse'
              example:
                status: true
                message: Labels added to tweets
          headers:
            Idempotency-Replayed:
              description: Present and true when this response was replayed from a stored idempotent result rather than executed again.
              schema:
                type: boolean
        '400':
          description: The request body failed validation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                status: false
                code: INVALID_REQUEST
                error: ''
                message: Invalid request parameters
        '401':
          description: Missing, malformed or revoked API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                status: false
                code: UNAUTHORIZED
                error: ''
                message: Unauthorized
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '422':
          $ref: '#/components/responses/IdempotencyConflict'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                tweet_ids:
                  type: array
                  items:
                    type: string
                  description: Non-empty array of bookmark (tweet) ids to label.
                label_id:
                  type: string
                  description: Id of an existing label. Either label_id or label_name is required.
                label_name:
                  type: string
                  description: Name of a label; created if it does not exist. Either label_id or label_name is required.
              required:
              - tweet_ids
      tags:
      - Labels
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      - $ref: '#/components/parameters/SandboxError'
  /labels/remove:
    post:
      operationId: RemoveLabels
      summary: Remove Labels from Tweets
      description: Remove labels from specific tweets.
      externalDocs:
        description: Endpoint documentation
        url: https://www.tweetsmash.com/api-docs/remove-labels
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponse'
              example:
                status: true
                message: Labels removed from tweets
          headers:
            Idempotency-Replayed:
              description: Present and true when this response was replayed from a stored idempotent result rather than executed again.
              schema:
                type: boolean
        '400':
          description: The request body failed validation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                status: false
                code: INVALID_REQUEST
                error: ''
                message: Invalid request parameters
        '401':
          description: Missing, malformed or revoked API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                status: false
                code: UNAUTHORIZED
                error: ''
                message: Unauthorized
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '422':
          $ref: '#/components/responses/IdempotencyConflict'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                tweet_ids:
                  type: array
                  items:
                    type: string
                  description: Non-empty array of bookmark (tweet) ids to remove the label from.
                label_name:
                  type: string
                  description: Name of the label to remove.
              required:
              - tweet_ids
              - label_name
      tags:
      - Labels
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      - $ref: '#/components/parameters/SandboxError'
  /labels/add-by-filter:
    post:
      operationId: AddLabelsByFilter
      summary: Add Labels by Filter (bulk)
      description: Add one label to EVERY bookmark matching a filter, in a single request — no need to list and loop. Returns how many bookmarks matched and were tagged.
      externalDocs:
        description: Endpoint documentation
        url: https://www.tweetsmash.com/api-docs/add-labels-by-filter
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponse'
              example:
                status: true
                data:
                  matched: 42
                  tagged: 42
                  failed: 0
                  truncated: false
                  label:
                    id: 177...
                    name: AI
          headers:
            Idempotency-Replayed:
              description: Present and true when this response was replayed from a stored idempotent result rather than executed again.
              schema:
                type: boolean
        '402':
          description: The account is on a plan that does not include this endpoint.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                status: false
                code: SUBSCRIPTION_REQUIRED
                error: A paid plan is required to modify labels.
                upgrade_url: https://www.tweetsmash.com/pricing
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/IdempotencyConflict'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                label_id:
                  type: string
                  description: Id of an existing label. Either label_id or label_name is required.
                label_name:
                  type: string
                  description: Name of a label; created if it does not exist. Either label_id or label_name is required.
                search_query:
                  type: string
                  description: Free-text query the bookmarks must match.
                filter:
                  type: string
                  description: Filter dimension to match on, e.g. author.
                value:
                  type: string
                  description: Value for the chosen filter.
                tags:
                  type: array
                  items:
                    type: string
                  description: Existing labels the bookmarks must already carry.
      tags:
      - Labels
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      - $ref: '#/components/parameters/SandboxError'
  /labels/batch:
    post:
      operationId: BatchLabels
      summary: Apply many label operations in one request
      description: Takes up to 50 label operations so an agent tidying a library does not make fifty round trips. Each operation reports its own result in request order. The status is 200 when every operation succeeded and 207 when at least one failed — a partial failure never discards the operations that worked.
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
      - $ref: '#/components/parameters/SandboxError'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - operations
              properties:
                operations:
                  type: array
                  minItems: 1
                  maxItems: 50
                  description: Label operations, applied in order.
                  items:
                    type: object
                    required:
                    - op
                    - tweet_ids
                    properties:
                      op:
                        type: string
                        enum:
                        - add
                        - remove
                      tweet_ids:
                        type: array
                        minItems: 1
                        items:
                          type: string
                        description: Non-empty array of bookmark (tweet) ids.
                      label_id:
                        type: string
                        description: Existing label id. On `add`, either label_id or label_name is required.
                      label_name:
                        type: string
                        description: Label name; created if it does not exist on `add`. Required on `remove`.
            example:
              operations:
              - op: add
                tweet_ids:
                - '1000000000000000001'
                label_name: ai
              - op: remove
                tweet_ids:
                - '1000000000000000002'
                label_name: todo
      responses:
        '200':
          description: Every operation succeeded.
          headers:
            Idempotency-Replayed:
              description: Present and true when replayed from a stored idempotent result.
              schema:
                type: boolean
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponse'
              example:
                status: true
                data:
                  results:
                  - index: 0
                    op: add
                    ok: true
                    affected: 1
                  succeeded: 1
                  failed: 0
                meta:
                  message: 1 operations applied.
        '207':
          description: At least one operation failed. The rest were still applied.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponse'
              example:
                status: true
                data:
                  results:
                  - index: 0
                    op: add
                    ok: true
                    affected: 1
                  - index: 1
                    op: remove
                    ok: false
                    error:
                      code: INVALID_REQUEST
                      message: label_name is required.
                  succeeded: 1
                  failed: 1
                meta:
                  message: 1 of 2 operations failed.
        '400':
          description: operations is missing, empty, or longer than 50.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                status: false
                code: INVALID_REQUEST
                error: operations must be a non-empty array of { op, tweet_ids, label_name | label_id }.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '422':
          $ref: '#/components/responses/IdempotencyConflict'
      externalDocs:
        description: Endpoint documentation
        url: https://www.tweetsmash.com/developers#batch
      tags:
      - Labels
components:
  responses:
    Unauthorized:
      description: Missing, malformed or revoked API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          example:
            status: false
            code: UNAUTHORIZED
            error: Unauthorized
    IdempotencyConflict:
      description: The Idempotency-Key was already used with a different request body.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          example:
            status: false
            code: INVALID_REQUEST
            error: This Idempotency-Key was already used with a different request body.
    PaymentRequired:
      description: The account is on a plan that does not include this endpoint.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          example:
            status: false
            code: SUBSCRIPTION_REQUIRED
            error: A paid plan is required.
  schemas:
    ApiResponse:
      type: object
      required:
      - status
      properties:
        status:
          type: boolean
          const: true
        data:
          description: The endpoint payload.
        message:
          type: string
        next_cursor:
          type:
          - string
          - 'null'
          description: Pass back as `cursor` to fetch the next page.
        meta:
          type: object
          description: Non-payload extras such as a human-readable message or paging counts.
          additionalProperties: true
    ApiError:
      type: object
      required:
      - status
      - code
      properties:
        status:
          type: boolean
          const: false
        code:
          type: string
          enum:
          - UNAUTHORIZED
          - SUBSCRIPTION_REQUIRED
          - FILTER_NOT_ALLOWED
          - PAGINATION_NOT_ALLOWED
          - VECTOR_SEARCH_NOT_ALLOWED
          - INVALID_REQUEST
          - NOT_FOUND
          - RATE_LIMITED
          - INTERNAL_ERROR
          description: Machine-readable error code. Do not retry on UNAUTHORIZED.
        error:
          type: string
          description: Human-readable message.
        message:
          type: string
          description: Human-readable message.
        upgrade_url:
          type: string
          format: uri
          description: Where the user upgrades to unlock this endpoint.
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      description: 'A caller-generated UUID identifying one logical write. The first request with a given key is executed and its response stored for 24 hours; a repeat of the same key returns the stored response with Idempotency-Replayed: true instead of doing the work twice. Reusing a key with a different body is rejected with 422.'
      schema:
        type: string
        format: uuid
    SandboxError:
      name: X-Tweetsmash-Sandbox-Error
      in: header
      required: false
      description: Sandbox server only. Forces the sandbox to answer with a specific failure so a client can test its error handling without an account.
      schema:
        type: string
        enum:
        - unauthorized
        - subscription_required
        - filter_not_allowed
        - pagination_not_allowed
        - invalid_request
        - not_found
        - rate_limited
        - server_error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'API key created at https://www.tweetsmash.com/integrations/api, sent as `Authorization: Bearer <key>`.'
externalDocs:
  description: API reference
  url: https://www.tweetsmash.com/api-docs