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

# Cancel Capacity

> Cancel a capacity reservation policy with applicable refunds based on cancellation timing.



## OpenAPI

````yaml /api-reference/flex-compute/flex-api.json post /external/api/v1/flexcompute/cancel
openapi: 3.1.0
info:
  title: Cloudidr FlexCompute API
  description: API for managing compute schedule policies and capacity reservations.
  version: 1.0.0
servers:
  - url: https://public-api.cloudidr.com
    description: Production server
security:
  - bearerAuth: []
paths:
  /external/api/v1/flexcompute/cancel:
    post:
      summary: Cancel Capacity
      description: >-
        Cancel a capacity reservation policy with applicable refunds based on
        cancellation timing.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - cidrId
              properties:
                cidrId:
                  type: string
                  description: Policy/Capacity ID to cancel
            example:
              cidrId: sc_1235674554
      responses:
        '200':
          description: Success - Policy canceled successfully with refund details
          content:
            application/json:
              examples:
                scenario1:
                  summary: Policy Cancelled Successfully
                  description: >-
                    This response indicates that the policy was canceled
                    successfully, with a refund applied based on the
                    cancellation conditions.
                  value:
                    message: Policy canceled successfully. Early-cancellation fee = 50
                scenario2:
                  summary: Cancellation within 15 minutes
                  description: >-
                    This response indicates scenario when the policy is
                    cancelled within 15 minutes after creation.
        '400':
          description: Bad Request - Cancellation not allowed
          content:
            application/json:
              example:
                error:
                  code: '400'
                  message: Bad Request
                  details:
                    timestamp: '2025-03-04T17:20:30'
                    description: >-
                      Cancellation not allowed, reason: Policy is already
                      canceled.
        '401':
          description: Unauthorized - Unable to process access token
          content:
            application/json:
              example:
                error:
                  code: '401'
                  message: Unauthorized
                  details:
                    timestamp: '2025-03-04T17:01:01'
                    description: Unable to process access token
        '404':
          description: >-
            Not Found - The specified cidr_id does not correspond to any
            existing schedule policy
          content:
            application/json:
              example:
                error:
                  code: '404'
                  message: Not Found
                  details:
                    timestamp: '2025-03-04T17:15:55'
                    description: Cidr rFVrfliRmYgD1 not found
        '500':
          description: Internal Server Error - Unexpected error occurred
          content:
            application/json:
              example:
                error:
                  code: '500'
                  message: Internal Server Error
                  details:
                    timestamp: '2025-03-04T17:17:08'
                    description: Unexpected error. Our team is working on it
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````