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

# Cancel a tracking request

> Cancel a pending or awaiting_manifest tracking request in the Terminal49 API so Terminal49 stops trying to find the shipment.

Cancels a tracking request whose `status` is `pending` or `awaiting_manifest`. The request moves to `status` `cancelled`, and `failed_reason` becomes `Cancelled by user`.

* A request in any other status returns `422`. The `errors` value in that response is a string, not a JSON:API errors array.
* A request that belongs to another account also returns `422`, not `404`.
* An unknown tracking request ID currently returns a `500` server error, not `404`. This differs from other lookups by ID, which return `404`. A `401` comes only from authentication. It means your API token is missing or invalid, or your account may not use the API.
* A request that has already created a shipment cannot be cancelled. To stop tracking that shipment, use [Stop tracking a shipment](/docs/api-docs/api-reference/shipments/stop-tracking-shipment).
* To find cancelled requests, filter the list with `filter[status]=cancelled`.


## OpenAPI

````yaml patch /tracking_requests/{id}/cancel
openapi: 3.0.0
info:
  title: Terminal49 API Reference
  version: 0.2.0
  contact:
    name: Terminal49 API support
    url: https://www.terminal49.com
    email: support@terminal49.com
  description: >-
    The Terminal 49 API offers a convenient way to programmatically track your
    shipments from origin to destination.


    Please enter your API key into the "Variables" tab before using these
    endpoints within Postman.
  x-label: Beta
  termsOfService: https://www.terminal49.com/terms
servers:
  - url: https://api.terminal49.com/v2
    description: Production
security:
  - authorization: []
tags:
  - name: Containers
  - name: Custom Field Definitions
  - name: Custom Field Options
  - name: Custom Fields
  - name: Shipments
  - name: Locations
  - name: Events
  - name: Tracking Requests
  - name: Webhooks
  - name: Webhook Notifications
  - name: Ports
  - name: Metro Areas
  - name: Terminals
  - name: Routing (Paid)
  - name: Documents
  - name: Email Submissions
  - name: Document Schemas
  - name: Search
  - name: Parties
  - name: Account
paths:
  /tracking_requests/{id}/cancel:
    parameters:
      - schema:
          type: string
          format: uuid
        name: id
        in: path
        required: true
        description: Tracking Request ID
    patch:
      tags:
        - Tracking Requests
      summary: Cancel a tracking request
      description: >-
        Cancel a tracking request that is still `pending` or
        `awaiting_manifest`. The request moves to status `cancelled` with
        failed_reason `Cancelled by user`. Requests in any other status return
        422. A request that belongs to another account also returns 422 with a
        string `errors`. An unknown tracking request ID currently returns a 500
        server error, not 404. A 401 comes only from authentication. It means
        the API token is missing or invalid, or the account may not use the API.
      operationId: patch-tracking-request-cancel
      responses:
        '200':
          description: Cancelled. The response body is an empty JSON object.
          content:
            application/json:
              schema:
                type: object
              example: {}
        '401':
          description: >-
            Unauthorized. The API token is missing or invalid, or the account
            may not use the API. Ownership never causes a 401 here: another
            account's tracking request returns 422.
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      $ref: '#/components/schemas/error'
              example:
                errors:
                  - detail: invalid API token
        '422':
          description: >-
            The tracking request is not in a cancellable status, or it belongs
            to another account.
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: string
              example:
                errors: >-
                  Can't cancel tracking request in created state.  Must be in
                  pending or awaiting_manifest state.
        '500':
          description: >-
            Server error. An unknown tracking request ID currently returns 500
            instead of 404.
components:
  schemas:
    error:
      title: Error model
      type: object
      properties:
        detail:
          type: string
          nullable: true
        title:
          type: string
          nullable: true
        source:
          type: object
          nullable: true
          properties:
            pointer:
              type: string
              nullable: true
            parameter:
              type: string
              nullable: true
        code:
          type: string
          nullable: true
        status:
          type: string
          nullable: true
        meta:
          type: object
          nullable: true
          additionalProperties: true
  securitySchemes:
    authorization:
      name: Authorization
      type: apiKey
      in: header
      description: >-
        Use a Terminal49 API key in the `Authorization` header with the `Token`
        prefix.


        `Authorization: Token YOUR_API_KEY`

````

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