---
updatedAt: 2026-04-21T05:40:31.000Z
agentTools:
  projectIndex: https://docs.sequra.com/llms.txt
---

# Cancel subscription

Cancel a subscription. The system automatically determines whether to withdraw (for early-stage subscriptions) or cancel (for active subscriptions) based on the subscription state.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "instore-api",
    "version": "v1"
  },
  "servers": [
    {
      "url": "http://localhost:3009"
    },
    {
      "url": "https://instore-sandbox.sequrapi.com/"
    },
    {
      "url": "https://instore.sequrapi.com/"
    },
    {
      "url": "https://{defaultHost}",
      "variables": {
        "defaultHost": {
          "default": "www.example.com"
        }
      }
    }
  ],
  "paths": {
    "/api/public/v1/subscriptions/{id}/cancel": {
      "post": {
        "summary": "Cancel subscription",
        "tags": [
          "Subscriptions"
        ],
        "description": "Cancel a subscription. The system automatically determines whether to withdraw (for early-stage subscriptions) or cancel (for active subscriptions) based on the subscription state.",
        "security": [
          {
            "basic_auth": []
          }
        ],
        "parameters": [
          {
            "name": "Authorization",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "examples": {
              "Subscription cancelled successfully": {
                "value": "Basic YXBpdXNlcjE6YXBpdXNlcjE="
              },
              "Unauthorized": {
                "value": "invalid"
              }
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Subscription ID (integer)",
            "schema": {
              "type": "string"
            },
            "examples": {
              "Subscription cancelled successfully": {
                "value": 633
              },
              "Subscription cancelled with reason": {
                "value": 635
              },
              "Unauthorized": {
                "value": 637
              },
              "Unauthorized - subscription belongs to different merchant": {
                "value": 643
              },
              "when subscription does not exist": {
                "value": 999999
              },
              "when subscription is already cancelled": {
                "value": 646
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Subscription cancelled with reason",
            "content": {
              "application/json": {
                "examples": {
                  "Subscription cancelled successfully": {
                    "value": {
                      "success": true,
                      "message": "Suscripción cancelada exitosamente"
                    }
                  },
                  "Subscription cancelled with reason": {
                    "value": {
                      "success": true,
                      "message": "Suscripción cancelada exitosamente"
                    }
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "message": {
                      "type": "string",
                      "example": "Subscription cancelled successfully"
                    }
                  },
                  "required": [
                    "success",
                    "message"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - subscription belongs to different merchant",
            "content": {
              "text/html": {
                "examples": {
                  "Unauthorized": {
                    "value": "HTTP Basic: Access denied.\n"
                  }
                }
              },
              "application/json": {
                "examples": {
                  "Unauthorized - subscription belongs to different merchant": {
                    "value": {
                      "errors": [
                        {
                          "code": "unauthorized",
                          "title": "You are not authorized to access this resource"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "examples": {
                  "when subscription does not exist": {
                    "value": {
                      "errors": [
                        {
                          "code": "not_found",
                          "title": "Subscription not found"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "examples": {
                  "when subscription is already cancelled": {
                    "value": {
                      "errors": [
                        {
                          "code": "invalid",
                          "title": "Subscription cannot be cancelled"
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "description": "Optional cancellation reason",
                    "example": "Customer request"
                  }
                }
              },
              "examples": {
                "Subscription cancelled with reason": {
                  "summary": "Subscription cancelled with reason",
                  "value": {
                    "reason": "Customer request"
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "basic_auth": {
        "type": "http",
        "scheme": "basic"
      }
    }
  }
}
```