> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mallary.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Cancel One Platform Job

> Stop one queued or retrying platform job without removing completed posts from the same batch.

Use this endpoint when one destination in a multi-platform post is still queued or retrying but other destinations have already published.

For example, if Instagram and TikTok completed but YouTube is waiting to retry, cancel the YouTube job ID to stop only that upload. The completed Instagram and TikTok posts stay unchanged.

> [!NOTE]
>
> A failed job is already terminal and cannot be cancelled. Use `GET /api/v1/jobs/{id}` to read its saved failure. To delete an entire grouped post before any destination starts publishing, use `DELETE /api/v1/posts/{id}`.


## OpenAPI

````yaml POST /api/v1/jobs/{id}/cancel
openapi: 3.0.3
info:
  title: Mallary API
  version: 1.6.0
  description: >
    Public API for multi-platform publishing, analytics, media upload, and
    webhooks.


    Authentication:

    - Use header `Authorization: Bearer {api_key}`.

    - API key identity is authoritative. Do not use `user_id` to identify a
    caller.


    Connection profiles:

    - Omit `profile_id` to use the authenticated user's default profile.

    - Send the profile's random public `profile_id` when you want to publish,
    list posts, read post analytics or audience counts, list platforms, update
    settings, or disconnect a platform for a non-default profile.

    - Use `GET /api/v1/profiles` to list profile IDs.

    - Total social media accounts: Starter 5 ($15/month), Pro 15 ($29/month),
    Business 100 ($95/month). Posts are unlimited. Scheduling, analytics, and AI
    auto-replies are included. X publishing and comments use credits at cost;
    analytics and account lookups use no credits. Existing customers keep their
    current terms; use the authenticated workspace limits.


    Rate limits (per user, per minute) depend on subscription plan:

    - plan_id 1: 75 req/min

    - plan_id 2: 150 req/min

    - plan_id 3: 750 req/min

    - plan_id 4: 1500 req/min
servers:
  - url: https://mallary.ai
    description: Production
security:
  - bearerAuth: []
externalDocs:
  description: Full product docs
  url: https://docs.mallary.ai/
paths:
  /api/v1/jobs/{id}/cancel:
    post:
      summary: Cancel one queued platform job
      description: >-
        Cancels only the selected queued or retrying platform job. Other jobs in
        the same multi-platform batch, including completed posts, are preserved.
        Failed jobs are already terminal and remain failed for accurate history.
      operationId: cancelJob
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: integer
          description: Job ID returned by `POST /api/v1/post`.
        - in: query
          name: profile_id
          required: false
          schema:
            $ref: '#/components/schemas/ProfileId'
          description: >-
            Optional current profile. A different or unavailable profile returns
            404.
      requestBody:
        required: false
        description: >-
          Optional concurrency guard. Read the current group revision from GET
          /api/v1/posts/{id}; stale revisions return 409. Omit to retain the
          existing unguarded behavior.
        content:
          application/json:
            schema:
              type: object
              properties:
                expected_revision:
                  type: integer
                  minimum: 1
      responses:
        '200':
          description: >-
            The selected job is cancelled and remains available through `GET
            /api/v1/jobs/{id}`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CancelJobResponse'
        '400':
          description: Invalid job ID
        '401':
          description: Missing or invalid API key
        '404':
          description: Job not found
        '409':
          description: >-
            Revision changed, or the selected platform job is processing,
            completed, failed, or otherwise no longer cancelable
components:
  schemas:
    ProfileId:
      type: string
      pattern: ^[A-Za-z0-9]{6,32}$
      example: AbC123xYz90
      description: Random public connection profile ID returned by `GET /api/v1/profiles`.
    CancelJobResponse:
      type: object
      properties:
        status:
          type: string
          enum:
            - ok
        data:
          type: object
          properties:
            job_id:
              type: integer
            batch_id:
              type: string
              nullable: true
            platform:
              $ref: '#/components/schemas/Platform'
            previous_status:
              type: string
            status:
              type: string
              enum:
                - cancelled
            completed_job_ids_preserved:
              type: array
              items:
                type: integer
    Platform:
      type: string
      description: Supported publishing platform identifier.
      enum:
        - twitter
        - x
        - facebook
        - instagram
        - linkedin
        - youtube
        - tiktok
        - pinterest
        - reddit
        - threads
        - bluesky
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Use `Authorization: Bearer {api_key}`'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.