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

# Cancel a service

> Cancels the service, or one of its addons (`addon_service`): at the end
of the paid term (`end_of_term`), or now (`immediate`), which PerfGrid
handles by hand. Needs `services.manage`.



## OpenAPI

````yaml /api-reference/console/openapi.json post /services/{service}/cancellations
openapi: 3.1.2
info:
  title: PerfGrid API
  version: 1.0.0
  description: >-
    The PerfGrid customer API. A member creates a token for one billing account
    under *API tokens* in the panel; it can do what both the token's permissions
    and the member's own permissions allow, the same as the panel.


    Send it as `Authorization: Bearer pgapi_...`. Each token may make 120
    requests a minute, of which 30 change something; a `429` response says when
    to try again (`Retry-After`). Ids are the ULIDs the API returns; amounts are
    decimal strings next to their currency; lists are newest first and paged
    with `cursor` (`meta.next_cursor`). Messages are in English, or Danish with
    `Accept-Language: da`.


    The same tokens work with the MCP server at `/mcp` for AI assistants.
servers:
  - url: https://console.perfgrid.com/api/v1
security:
  - http: []
tags:
  - name: Account
  - name: Invoices
  - name: Services
  - name: Domains
  - name: Support
paths:
  /services/{service}/cancellations:
    post:
      tags:
        - Services
      summary: Cancel a service
      description: |-
        Cancels the service, or one of its addons (`addon_service`): at the end
        of the paid term (`end_of_term`), or now (`immediate`), which PerfGrid
        handles by hand. Needs `services.manage`.
      operationId: v1.services.cancellations.store
      parameters:
        - name: service
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                type:
                  $ref: '#/components/schemas/CancellationType'
                reason:
                  type:
                    - string
                    - 'null'
                  maxLength: 1000
                addon_service:
                  type:
                    - string
                    - 'null'
                  minLength: 26
                  maxLength: 26
              required:
                - type
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items: {}
                required:
                  - data
        '422':
          $ref: '#/components/responses/ValidationException'
components:
  schemas:
    CancellationType:
      type: string
      description: >
        When a cancellation takes effect: at the end of the paid term
        (`end_of_term`), accepted at once and open to withdrawal until then, or
        now (`immediate`), once PerfGrid has handled the request.
      enum:
        - end_of_term
        - immediate
      title: CancellationType
  responses:
    ValidationException:
      description: Validation error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Errors overview.
              errors:
                type: object
                description: A detailed description of each field that failed validation.
                additionalProperties:
                  type: array
                  items:
                    type: string
            required:
              - message
              - errors
  securitySchemes:
    http:
      type: http
      description: >-
        An API token from *API tokens* in the console, sent as `Authorization:
        Bearer pgapi_...`. It works for one billing account, and its permissions
        decide which endpoints it may call.
      scheme: bearer

````

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