---
title: "Cancelar assinatura"
url: "https://devcenter.stone.com.br/apis/v5-docs-legacy/versions/b9aaff36-6dcc-4353-8398-836d6c13dfa5/operations/cancelar-assinatura-1"
---

> Full API specification: https://devcenter.stone.com.br/apis/v5-docs-legacy/versions/b9aaff36-6dcc-4353-8398-836d6c13dfa5.md

# Cancelar assinatura

`DELETE` `/subscriptions/{subscription_id}`

Operation ID: `cancelar-assinatura-1`

Com o verbo HTTP DELETE, através do identificador da assinatura (`subscription_id`) é possível cancelar a assinatura.

## Path parameters

- `subscription_id` (string, required) - Código da assinatura.<br>Formato: `sub_XXXXXXXXXXXXXXXX`.

## Request body

Content types: `application/json`

## Responses

- `200` - 200
- `404` - 404

## OpenAPI definition

```yaml
openapi: 3.1.0
info:
  title: Pagar.me v5 API (Legado)
  version: 5.0.0
servers:
  - url: https://api.stone.com.br/core/v5
paths:
  /subscriptions/{subscription_id}:
    delete:
      summary: Cancelar assinatura
      description: Com o verbo HTTP DELETE, através do identificador da assinatura
        (`subscription_id`) é possível cancelar a assinatura.
      operationId: cancelar-assinatura-1
      parameters:
        - name: subscription_id
          in: path
          description: "Código da assinatura.<br>Formato: `sub_XXXXXXXXXXXXXXXX`."
          schema:
            type: string
          required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                cancel_pending_invoices:
                  type: boolean
                  description: Parâmetro que define se as cobranças e faturas pendentes dentro de
                    uma assinatura serão canceladas automaticamente com a
                    execução do cancelamento da assinatura
                  default: true
      responses:
        "200":
          description: "200"
          content:
            application/json:
              examples:
                Result:
                  value: >-
                    {
                        "id": "sub_WeEMlp2FXFMjVq3Q",
                        "code": "8YNU49TD4Z",
                        "start_at": "2018-04-05T00:00:00Z",
                        "interval": "month",
                        "interval_count": 1,
                        "billing_type": "postpaid",
                        "boleto_due_days":5,
                        "current_cycle": {
                            "id": "cycle_6ow0JqhD5sJmMJPl",
                            "start_at": "2018-04-05T00:00:00Z",
                            "end_at": "2018-05-04T23:59:59Z",
                            "billing_at": "2018-04-05T00:00:00Z"
                        },
                        "setup": {
                            "id": "or_0Wd7bYRMSmSYy8qz",
                            "description": "Inscrição",
                            "amount": 9990,
                            "status": "paid"
                        },
                        "next_billing_at": "2018-04-05T00:00:00Z",
                        "payment_method": "boleto",
                        "currency": "BRL",
                        "statement_descriptor": "Spotify",
                        "installments": 1,
                        "status": "canceled",
                        "created_at": "2018-04-05T03:20:16Z",
                        "updated_at": "2018-04-05T12:14:06Z",
                        "canceled_at": "2018-04-05T12:14:06Z",
                        "customer": {
                            "id": "cus_px3yqRSlRsVqawgj",
                            "name": "Tony Stark",
                            "email": "ef61ded5-9e60-40c7-89cd-a3b6e70515e8@avengers.com",
                            "delinquent": false,
                            "created_at": "2018-04-05T03:20:15Z",
                            "updated_at": "2018-04-05T03:20:15Z",
                            "phones": {}
                        },
                        "plan": {
                            "id": "plan_dxVldzsgzu9rpe8v",
                            "name": "Premium",
                            "description": "Vá de Premium. E seja feliz!",
                            "url": "/plans/plan_dxVldzsgzu9rpe8v/vodafone-teste/premium",
                            "statement_descriptor": "Spotify",
                            "interval": "month",
                            "interval_count": 1,
                            "billing_type": "postpaid",
                            "payment_methods": [
                                "boleto",
                                "credit_card"
                            ],
                            "installments": [
                                1
                            ],
                            "status": "active",
                            "currency": "BRL",
                            "created_at": "2018-04-04T22:17:16Z",
                            "updated_at": "2018-04-04T22:17:16Z"
                        },
                        "items": [
                            {
                                "id": "si_5LPVYR1c7WuJd06l",
                                "name": "Name - Premium",
                                "description": "Test - Description",
                                "quantity": 1,
                                "status": "active",
                                "created_at": "2018-04-05T03:20:16Z",
                                "updated_at": "2018-04-05T03:20:16Z",
                                "pricing_scheme": {
                                    "price": 1490,
                                    "scheme_type": "unit"
                                }
                            }
                        ]
                    }
              schema:
                type: object
                properties:
                  id:
                    type: string
                    example: sub_WeEMlp2FXFMjVq3Q
                  code:
                    type: string
                    example: 8YNU49TD4Z
                  start_at:
                    type: string
                    example: 2018-04-05T00:00:00Z
                  interval:
                    type: string
                    example: month
                  interval_count:
                    type: integer
                    example: 1
                    default: 0
                  billing_type:
                    type: string
                    example: postpaid
                  boleto_due_days:
                    type: integer
                    example: 5
                    default: 0
                  current_cycle:
                    type: object
                    properties:
                      id:
                        type: string
                        example: cycle_6ow0JqhD5sJmMJPl
                      start_at:
                        type: string
                        example: 2018-04-05T00:00:00Z
                      end_at:
                        type: string
                        example: 2018-05-04T23:59:59Z
                      billing_at:
                        type: string
                        example: 2018-04-05T00:00:00Z
                  setup:
                    type: object
                    properties:
                      id:
                        type: string
                        example: or_0Wd7bYRMSmSYy8qz
                      description:
                        type: string
                        example: Inscrição
                      amount:
                        type: integer
                        example: 9990
                        default: 0
                      status:
                        type: string
                        example: paid
                  next_billing_at:
                    type: string
                    example: 2018-04-05T00:00:00Z
                  payment_method:
                    type: string
                    example: boleto
                  currency:
                    type: string
                    example: BRL
                  statement_descriptor:
                    type: string
                    example: Spotify
                  installments:
                    type: integer
                    example: 1
                    default: 0
                  status:
                    type: string
                    example: canceled
                  created_at:
                    type: string
                    example: 2018-04-05T03:20:16Z
                  updated_at:
                    type: string
                    example: 2018-04-05T12:14:06Z
                  canceled_at:
                    type: string
                    example: 2018-04-05T12:14:06Z
                  customer:
                    type: object
                    properties:
                      id:
                        type: string
                        example: cus_px3yqRSlRsVqawgj
                      name:
                        type: string
                        example: Tony Stark
                      email:
                        type: string
                        example: ef61ded5-9e60-40c7-89cd-a3b6e70515e8@avengers.com
                      delinquent:
                        type: boolean
                        example: false
                        default: true
                      created_at:
                        type: string
                        example: 2018-04-05T03:20:15Z
                      updated_at:
                        type: string
                        example: 2018-04-05T03:20:15Z
                      phones:
                        type: object
                        properties: {}
                  plan:
                    type: object
                    properties:
                      id:
                        type: string
                        example: plan_dxVldzsgzu9rpe8v
                      name:
                        type: string
                        example: Premium
                      description:
                        type: string
                        example: Vá de Premium. E seja feliz!
                      url:
                        type: string
                        example: /plans/plan_dxVldzsgzu9rpe8v/vodafone-teste/premium
                      statement_descriptor:
                        type: string
                        example: Spotify
                      interval:
                        type: string
                        example: month
                      interval_count:
                        type: integer
                        example: 1
                        default: 0
                      billing_type:
                        type: string
                        example: postpaid
                      payment_methods:
                        type: array
                        items:
                          type: string
                          example: boleto
                      installments:
                        type: array
                        items:
                          type: integer
                          example: 1
                          default: 0
                      status:
                        type: string
                        example: active
                      currency:
                        type: string
                        example: BRL
                      created_at:
                        type: string
                        example: 2018-04-04T22:17:16Z
                      updated_at:
                        type: string
                        example: 2018-04-04T22:17:16Z
                  items:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          example: si_5LPVYR1c7WuJd06l
                        name:
                          type: string
                          example: Name - Premium
                        description:
                          type: string
                          example: Test - Description
                        quantity:
                          type: integer
                          example: 1
                          default: 0
                        status:
                          type: string
                          example: active
                        created_at:
                          type: string
                          example: 2018-04-05T03:20:16Z
                        updated_at:
                          type: string
                          example: 2018-04-05T03:20:16Z
                        pricing_scheme:
                          type: object
                          properties:
                            price:
                              type: integer
                              example: 1490
                              default: 0
                            scheme_type:
                              type: string
                              example: unit
        "404":
          description: "404"
          content:
            application/json:
              examples:
                Result:
                  value: |-
                    {
                        "message": "Subscription not found."
                    }
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Subscription not found.
      deprecated: false
security:
  - sec0: []
components:
  securitySchemes:
    sec0:
      type: http
      scheme: basic
```
