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

# Delete a subscription

> Deletes one subscription if it belongs to the authenticated API key owner.



## OpenAPI

````yaml /api/openapi.yaml delete /api/v1/subscriptions/{id}
openapi: 3.1.0
info:
  title: Subscription Manager Public API
  version: 1.0.0
  description: >-
    Public API for subscription CRUD automation through Developer API keys. The
    operation descriptions include AI-oriented task semantics, risk levels, and
    confirmation guidance for agent integrations.
servers:
  - url: https://your-site.example
    description: Replace with your deployed Subscription Manager site URL.
security:
  - bearerApiKey: []
tags:
  - name: Subscriptions
    description: Create, read, update, and delete subscriptions for the API key owner.
    x-ai:
      domain: subscription_management
      ownerScope: authenticated_api_key_owner
      writeSafety: >-
        Confirm create, update, cancel, pause, resume, and delete operations
        with the user before calling them from an AI agent. Write operations
        require an API key with the write scope.
  - name: Analytics
    description: >-
      Computed spend summaries, duplicate detection, and optimization
      candidates. Read-only; money is reported per currency and never converted.
  - name: Audit
    description: Read-only audit trail of write operations performed through the API.
paths:
  /api/v1/subscriptions/{id}:
    parameters:
      - name: id
        in: path
        required: true
        description: Subscription UUID.
        schema:
          type: string
          format: uuid
        example: 33333333-3333-4333-8333-333333333333
    delete:
      tags:
        - Subscriptions
      summary: Delete a subscription
      description: >-
        Deletes one subscription if it belongs to the authenticated API key
        owner.
      operationId: deleteSubscription
      responses:
        '200':
          description: Subscription deleted.
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/XRateLimitLimit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/XRateLimitRemaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/XRateLimitReset'
          content:
            application/json:
              schema:
                type: object
                required:
                  - deleted
                  - requestId
                properties:
                  deleted:
                    type: boolean
                    const: true
                  requestId:
                    type: string
                additionalProperties: false
              examples:
                deleted:
                  value:
                    deleted: true
                    requestId: request-1
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  headers:
    XRateLimitLimit:
      description: Total allowed requests in the current fixed window.
      schema:
        type: integer
        example: 60
    XRateLimitRemaining:
      description: Requests remaining in the current fixed window.
      schema:
        type: integer
        example: 59
    XRateLimitReset:
      description: Unix timestamp in seconds when the fixed window resets.
      schema:
        type: integer
        example: 1781690400
    RetryAfter:
      description: >-
        Seconds to wait before retrying. Sent with 429 responses, including when
        too many invalid API key attempts are throttled.
      schema:
        type: integer
        example: 2700
  responses:
    BadRequest:
      description: >-
        The request payload or path parameter is invalid. Validation failures
        are rejected before the hourly quota is consumed, so they do not carry
        rate-limit headers.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            invalidField:
              value:
                error:
                  code: invalid_subscription_field
                  message: 'Field is not writable: nextPaymentDate'
                  field: nextPaymentDate
                  suggestedFix: >-
                    Remove server-managed fields such as id, nextPaymentDate,
                    createdAt, and updatedAt before retrying.
                  writableFields:
                    - amount
                    - category
                    - currency
                    - customDate
                    - lastPaymentDate
                    - name
                    - notificationEnabled
                    - period
                    - status
                requestId: request-1
            invalidPeriod:
              value:
                error:
                  code: invalid_subscription
                  message: Invalid option
                  field: period
                  suggestedFix: >-
                    Use one of the supported billing periods: monthly, yearly,
                    custom.
                  allowedValues:
                    - monthly
                    - yearly
                    - custom
                requestId: request-1
            invalidPagination:
              value:
                error:
                  code: invalid_pagination
                  message: limit cannot exceed 100
                  field: limit
                  suggestedFix: >-
                    Use limit between 1 and 100 and a non-negative offset, for
                    example ?limit=50&offset=0.
                requestId: request-1
    Unauthorized:
      description: The API key is missing, invalid, or revoked.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            invalidApiKey:
              value:
                error:
                  code: invalid_api_key
                  message: Invalid API key
                requestId: request-1
    Forbidden:
      description: The API key lacks the scope required for this operation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            insufficientScope:
              value:
                error:
                  code: insufficient_scope
                  message: This API key does not have the required 'write' scope
                  suggestedFix: >-
                    Use an API key created with the write scope. Read-only keys
                    can only list and read subscriptions.
                requestId: request-1
    NotFound:
      description: The subscription was not found for the API key owner.
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/XRateLimitLimit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/XRateLimitRemaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/XRateLimitReset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            missing:
              value:
                error:
                  code: subscription_not_found
                  message: Subscription not found
                requestId: request-1
    RateLimited:
      description: The user request limit or invalid-auth attempt limit was exceeded.
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/XRateLimitLimit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/XRateLimitRemaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/XRateLimitReset'
        Retry-After:
          $ref: '#/components/headers/RetryAfter'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            rateLimited:
              value:
                error:
                  code: rate_limit_exceeded
                  message: Rate limit exceeded
                requestId: request-1
            tooManyInvalidKeys:
              value:
                error:
                  code: rate_limit_exceeded
                  message: Too many invalid API key attempts
                requestId: request-1
    InternalError:
      description: Unexpected server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            internal:
              value:
                error:
                  code: internal_error
                  message: Internal server error
                requestId: request-1
  schemas:
    ErrorResponse:
      type: object
      required:
        - error
        - requestId
      properties:
        error:
          $ref: '#/components/schemas/Error'
        requestId:
          type: string
      additionalProperties: false
    Error:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
        message:
          type: string
        field:
          type: string
          description: Field that caused the error when the server can identify one.
        suggestedFix:
          type: string
          description: Human- and AI-readable correction hint.
        allowedValues:
          type: array
          items:
            type: string
          description: Allowed enum values when the error is caused by an unsupported enum.
        writableFields:
          type: array
          items:
            type: string
          description: >-
            Writable subscription fields when the error is caused by a
            non-writable field.
      additionalProperties: false
  securitySchemes:
    bearerApiKey:
      type: http
      scheme: bearer
      description: >-
        Developer API key generated in the app. Keys carry scopes; a read key
        can call list, get, analytics, and audit endpoints, while a write key
        additionally allows create, update, cancel, pause, resume, and delete.
      x-default: subm_your_key_here

````