# Cancel scheduled messages

Cancel one or more scheduled message batches by ID or by batch metadata. If using metadata, all batches matching the given key and value will be cancelled.
To successfully cancel a batch, you must do so before the `send_after` time. Batches without a `send_after` value (i.e., batches that are sent immediately) cannot be cancelled.
Cancellation is performed asynchronously. This means that this method always returns a 200 response, even if the cancellation fails.

Endpoint: DELETE /v1/projects/{project_id}/messages
Version: 1.0
Security: BearerAuth

## Security:

  - `BearerAuth` (unknown)
    http bearer

## Path parameters:

  - `project_id` (string, required)
    The unique ID of the project. You can find this on the [Sinch Dashboard](https://dashboard.sinch.com/convapi/apps).

## Request fields (application/json):

  - `batch_id` (string)

  - `metadata_filter` (object)

  - `metadata_filter.key_name` (string)

  - `metadata_filter.key_value` (string)

## Request examples:

  - `Cancel batch by id` (unknown)

  - `Cancel batches by metadata` (unknown)

## Response 200:

  - `200` (unknown)
    OK

## Response 401:

  - `401` (unknown)
    Invalid credentials

## Response 403:

  - `403` (unknown)
    Permission denied. The specified project may not be allowed to use the batch endpoint.

## Response 403 fields (application/json):

  - `code` (integer)

  - `message` (string)

  - `status` (string)

  - `details` (array)

## Response 500:

  - `500` (unknown)
    Internal error

## Response 500 fields (application/json):

  - `code` (integer)

  - `message` (string)

  - `status` (string)

  - `details` (array)

## Response 403 examples:

  - `Permission denied` (unknown)

## Response 500 examples:

  - `Internal error` (unknown)

