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

# Cancel a scheduled email message

> Cancels a scheduled email and returns it with status `cancelled`. The legacy `/v2/emails/{id}/schedule` DELETE route is an alias.



## OpenAPI

````yaml /openapi/generated/email/messages.yml delete /email_messages/{email_id}/schedule
openapi: 3.1.0
info:
  contact:
    email: support@telnyx.com
  description: API for sending and retrieving email messages.
  title: Telnyx Email Messages API
  version: 2.0.0
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
paths:
  /email_messages/{email_id}/schedule:
    delete:
      tags:
        - Email Messages
      summary: Cancel a scheduled email message
      description: >-
        Cancels a scheduled email and returns it with status `cancelled`. The
        legacy `/v2/emails/{id}/schedule` DELETE route is an alias.
      operationId: CancelScheduledEmailMessage
      parameters:
        - name: email_id
          in: path
          required: true
          description: Email message UUID.
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Scheduled email cancelled.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmailMessageResponse'
        '400':
          $ref: '#/components/responses/email_BadRequestResponse'
        '401':
          $ref: '#/components/responses/email_UnauthorizedResponse'
        '404':
          $ref: '#/components/responses/email_NotFoundResponse'
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import Telnyx from 'telnyx';

            const client = new Telnyx({
              apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
            });

            await client.emailMessages.deleteSchedule('email_id');
        - lang: Python
          source: |-
            import os
            from telnyx import Telnyx

            client = Telnyx(
                api_key=os.environ.get("TELNYX_API_KEY"),  # This is the default and can be omitted
            )
            client.email_messages.delete_schedule(
                "email_id",
            )
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\n\t\"github.com/team-telnyx/telnyx-go\"\n\t\"github.com/team-telnyx/telnyx-go/option\"\n)\n\nfunc main() {\n\tclient := telnyx.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\terr := client.EmailMessages.DeleteSchedule(\n\t\tcontext.TODO(),\n\t\t\"email_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n"
        - lang: Java
          source: |-
            package com.telnyx.sdk.example;

            import com.telnyx.sdk.client.TelnyxClient;
            import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;

            public final class Main {
                private Main() {}

                public static void main(String[] args) {
                    TelnyxClient client = TelnyxOkHttpClient.fromEnv();

                    client.emailMessages().deleteSchedule("email_id");
                }
            }
        - lang: Ruby
          source: |-
            require "telnyx"

            telnyx = Telnyx::Client.new(api_key: "My API Key")

            response = telnyx.email_messages.delete_schedule("email_id")

            puts(response)
        - lang: PHP
          source: >-
            <?php


            require_once dirname(__DIR__) . '/vendor/autoload.php';


            use Telnyx\Client;

            use Telnyx\Core\Exceptions\APIException;


            $client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API
            Key');


            try {
              $response = $client->emailMessages->deleteSchedule(
                'email_id',
              );

              var_dump($response);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: CLI
          source: |-
            telnyx email-messages delete-schedule \
              --api-key 'My API Key' \
              --email-id email_id
components:
  schemas:
    EmailMessageResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/EmailMessage'
        suppressed:
          type: array
          description: >-
            Recipients removed by suppression checks when at least one recipient
            remains and the message is accepted.
          items:
            $ref: '#/components/schemas/SuppressedRecipient'
      required:
        - data
    EmailMessage:
      type: object
      properties:
        record_type:
          type: string
          enum:
            - email_message
        id:
          type: string
          format: uuid
        status:
          $ref: '#/components/schemas/EmailMessageStatus'
        from:
          $ref: '#/components/schemas/EmailAddress'
        to:
          type: array
          items:
            $ref: '#/components/schemas/EmailAddress'
        cc:
          type: array
          items:
            $ref: '#/components/schemas/EmailAddress'
        bcc:
          type: array
          items:
            $ref: '#/components/schemas/EmailAddress'
        reply_to:
          type:
            - string
            - 'null'
        subject:
          type: string
        template_id:
          type:
            - string
            - 'null'
          format: uuid
        template_variables:
          type: object
          additionalProperties: true
          default: {}
        attachments:
          type: array
          items:
            $ref: '#/components/schemas/AttachmentResponse'
        events:
          type: array
          items:
            $ref: '#/components/schemas/MessageEvent'
        created_at:
          type: string
          format: date-time
        scheduled_at:
          type: string
          format: date-time
          description: >-
            Present when a scheduled_at value was stored. Persists even after
            the scheduled send has been processed or cancelled.
        inline_css:
          type: boolean
          description: >-
            Present when true in the immediate create response. Not persisted;
            absent on subsequent GET requests.
        sandbox:
          type: boolean
          description: Present when sandbox mode was used.
        recipient_statuses:
          type: object
          description: >
            Per-status recipient counts for the message. Present only for
            outbound messages

            with recipient rows. Keys are recipient statuses, values are counts.

            Example: `{"delivered": 998, "bounced": 2}`.
          additionalProperties:
            type: integer
          example:
            delivered: 998
            bounced: 2
      required:
        - record_type
        - id
        - status
        - from
        - to
        - cc
        - bcc
        - subject
        - reply_to
        - template_id
        - template_variables
        - attachments
        - events
        - created_at
    SuppressedRecipient:
      type: object
      properties:
        to:
          type: string
          format: email
          description: Suppressed recipient email address.
        reason:
          type: string
          description: Suppression reason returned by the recipient suppression service.
        scope:
          type: string
          description: Scope at which the suppression applies.
        override_allowed:
          type: boolean
          description: Whether an authorized send may override this suppression.
      required:
        - to
        - reason
        - scope
        - override_allowed
    email_ErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/ErrorObject'
        suppressed:
          type: array
          description: >-
            Present when every recipient is suppressed, so the request is
            rejected and no message is created.
          items:
            $ref: '#/components/schemas/SuppressedRecipient'
      required:
        - errors
    EmailMessageStatus:
      type: string
      description: >-
        Current status of an email message. Lifecycle statuses (queued,
        scheduled, etc.) are set on creation. Delivery statuses (delivered,
        bounced, etc.) are updated by delivery event consumers.
      enum:
        - queued
        - scheduled
        - cancelled
        - sandbox
        - sending
        - sent
        - failed
        - deferred
        - delivered
        - bounced
        - complained
        - rejected
        - opened
        - clicked
        - unsubscribed
    EmailAddress:
      type: object
      properties:
        email:
          type: string
        name:
          type: string
      required:
        - email
    AttachmentResponse:
      type: object
      description: EDR-aligned attachment metadata. The base64 `content` is never returned.
      properties:
        url:
          type:
            - string
            - 'null'
          format: uri
          description: Telnyx-hosted public URL for the attachment content.
        sha256:
          type:
            - string
            - 'null'
          description: SHA-256 hex digest of the attachment content.
        size_bytes:
          type:
            - integer
            - 'null'
          description: Attachment size in bytes.
        filename:
          type: string
        content_type:
          type: string
        disposition:
          type: string
          default: attachment
          description: >-
            MIME disposition (e.g. `attachment` or `inline`). Runtime passes
            through the stored value without enforcing an enum.
        content_id:
          type:
            - string
            - 'null'
          description: MIME Content-ID for inline references.
      required:
        - url
        - sha256
        - size_bytes
        - filename
        - content_type
        - disposition
        - content_id
    MessageEvent:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/EmailEventType'
        occurred_at:
          type: string
          format: date-time
        payload:
          type: object
          additionalProperties: true
      required:
        - type
        - occurred_at
    ErrorObject:
      type: object
      properties:
        code:
          type: string
          description: >-
            Telnyx error code. Edge idempotency errors use 10027 or 10036.
            Fallback 404/500 responses from the framework may use string status
            codes ('404', '500') instead.
          enum:
            - '10001'
            - '10006'
            - '10007'
            - '10015'
            - '10016'
            - '10019'
            - recipient_suppressed
            - reputation_suspended
            - '404'
            - '500'
            - '10027'
            - '10036'
        title:
          type: string
        detail:
          description: >-
            Human-readable error detail. Changeset responses may return a
            structured object.
          oneOf:
            - type: string
            - type: object
              additionalProperties: true
        source:
          type:
            - object
            - 'null'
          additionalProperties: true
        meta:
          type:
            - object
            - 'null'
          additionalProperties: true
          description: Additional metadata. Present on 401 errors with a documentation URL.
      required:
        - code
        - title
        - detail
    EmailEventType:
      type: string
      enum:
        - queued
        - deferred
        - scheduled
        - cancelled
        - sandbox
        - sending
        - sent
        - failed
        - delivered
        - bounced
        - complained
        - rejected
        - opened
        - clicked
        - unsubscribed
        - daily_limit_exceeded
  responses:
    email_BadRequestResponse:
      description: Bad Request / Validation Failed (10015).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/email_ErrorResponse'
          example:
            errors:
              - code: '10015'
                title: Bad Request
                detail: email is required
    email_UnauthorizedResponse:
      description: Not authorized (10006).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/email_ErrorResponse'
          example:
            errors:
              - code: '10006'
                title: Not authorized
                detail: Invalid API key
                meta:
                  url: https://developers.telnyx.com/docs/overview/errors/10006
    email_NotFoundResponse:
      description: Resource not found (10001).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/email_ErrorResponse'
          example:
            errors:
              - code: '10001'
                title: Not Found
                detail: The requested resource was not found
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````