POST
/
subscriptions
/
{id}
/
cancel
curl --request POST \
  --url https://api.alguna.io/subscriptions/{id}/cancel \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "effectiveEndDate": {},
  "shouldSendCancelationEmail": true,
  "cancelationReason": {},
  "cancelationReasonDescription": "<string>"
}'
{
  "id": "sub_8Np7AWxL4QvkprmjmloXuT",
  "customerId": "cus_0000000000000000000000",
  "name": "Waystar Royco - 2024",
  "description": "Initial contract for Waystar Royco",
  "purchaseOrderNumber": "WRO-2024-001",
  "contractStartDate": "2024-02-01T00:00:00Z",
  "currency": "USD",
  "status": "draft",
  "activationMode": "manual",
  "currentVersion": {
    "id": "subv_9Ak3BwqR7TzvlsqnkmpYvU",
    "effectiveStartDate": "2024-02-01T00:00:00Z",
    "effectiveEndDate": null,
    "status": "draft",
    "items": [
      {
        "priceId": "price_0000000000000000000000",
        "type": "unit",
        "unitAmount": "199.99"
      },
      {
        "priceId": "price_0000000000000001111111",
        "type": "unit",
        "unitAmount": "99.99"
      },
      {
        "priceId": "price_0000000000000002222222",
        "type": "tiered",
        "tiers": [
          {
            "minUnits": 1,
            "maxUnits": 100,
            "unitAmount": "0.10",
            "fixedAmount": "0.00"
          },
          {
            "minUnits": 100,
            "maxUnits": 200,
            "unitAmount": "0.09",
            "fixedAmount": "0.00"
          },
          {
            "minUnits": 200,
            "maxUnits": 300,
            "unitAmount": "0.08",
            "fixedAmount": "0.00"
          },
          {
            "minUnits": 300,
            "maxUnits": null,
            "unitAmount": "0.07",
            "fixedAmount": "0.00"
          }
        ]
      },
      {
        "priceId": "price_0000000000000003333333",
        "type": "fixed",
        "unitAmount": "24.99",
        "quantity": "2"
      },
      {
        "bundleId": "bundle_0000000000000001111111",
        "prices": [
          {
            "priceId": "price_0000000000000004444444",
            "type": "unit",
            "unitAmount": "49.99"
          },
          {
            "priceId": "price_0000000000000005555555",
            "type": "unit",
            "unitAmount": "29.99"
          }
        ]
      }
    ],
    "thresholds": [
      {
	      "id": "subt_0000000000000001111111",
        "type": "max",
        "value": "10000.00",
        "interval": "month",
        "scope": {
          "type": "global"
        }
      },
      {
	      "id": "subt_0000000000000002222222",
        "type": "min",
        "value": "1000.00",
        "interval": "month",
        "scope": {
          "type": "items",
          "ids": ["bundle_0000000000000001111111"]
        }
      }
    ],
    "discounts": [
      {
	      "id": "subd_0000000000000001111111",
        "type": "percentage",
        "value": "10",
        "scope": {
          "type": "items",
          "ids": ["price_0000000000000000000000", "price_0000000000000001111111"]
        }
      }
    ]
  },
  "createdAt": "2024-01-01T00:00:00Z",
  "updatedAt": "2024-01-01T00:00:00Z",
  "canceledAt": null,
  "completedAt": null
}

On successful request, the subscription will enter a canceling status.

Params

effectiveEndDate
apitypes.RFC3339Time

The effective end date of the subscription or quote version, formatted in RFC3339.

shouldSendCancelationEmail
boolean

Indicates whether a cancellation email should be sent upon cancellation.

cancelationReason
types.QuoteCancelationReason

The reason for cancellation, selected from a predefined set of cancellation reasons.

cancelationReasonDescription
string

A detailed description providing additional context for the cancellation reason.

Response

{
  "id": "sub_8Np7AWxL4QvkprmjmloXuT",
  "customerId": "cus_0000000000000000000000",
  "name": "Waystar Royco - 2024",
  "description": "Initial contract for Waystar Royco",
  "purchaseOrderNumber": "WRO-2024-001",
  "contractStartDate": "2024-02-01T00:00:00Z",
  "currency": "USD",
  "status": "draft",
  "activationMode": "manual",
  "currentVersion": {
    "id": "subv_9Ak3BwqR7TzvlsqnkmpYvU",
    "effectiveStartDate": "2024-02-01T00:00:00Z",
    "effectiveEndDate": null,
    "status": "draft",
    "items": [
      {
        "priceId": "price_0000000000000000000000",
        "type": "unit",
        "unitAmount": "199.99"
      },
      {
        "priceId": "price_0000000000000001111111",
        "type": "unit",
        "unitAmount": "99.99"
      },
      {
        "priceId": "price_0000000000000002222222",
        "type": "tiered",
        "tiers": [
          {
            "minUnits": 1,
            "maxUnits": 100,
            "unitAmount": "0.10",
            "fixedAmount": "0.00"
          },
          {
            "minUnits": 100,
            "maxUnits": 200,
            "unitAmount": "0.09",
            "fixedAmount": "0.00"
          },
          {
            "minUnits": 200,
            "maxUnits": 300,
            "unitAmount": "0.08",
            "fixedAmount": "0.00"
          },
          {
            "minUnits": 300,
            "maxUnits": null,
            "unitAmount": "0.07",
            "fixedAmount": "0.00"
          }
        ]
      },
      {
        "priceId": "price_0000000000000003333333",
        "type": "fixed",
        "unitAmount": "24.99",
        "quantity": "2"
      },
      {
        "bundleId": "bundle_0000000000000001111111",
        "prices": [
          {
            "priceId": "price_0000000000000004444444",
            "type": "unit",
            "unitAmount": "49.99"
          },
          {
            "priceId": "price_0000000000000005555555",
            "type": "unit",
            "unitAmount": "29.99"
          }
        ]
      }
    ],
    "thresholds": [
      {
	      "id": "subt_0000000000000001111111",
        "type": "max",
        "value": "10000.00",
        "interval": "month",
        "scope": {
          "type": "global"
        }
      },
      {
	      "id": "subt_0000000000000002222222",
        "type": "min",
        "value": "1000.00",
        "interval": "month",
        "scope": {
          "type": "items",
          "ids": ["bundle_0000000000000001111111"]
        }
      }
    ],
    "discounts": [
      {
	      "id": "subd_0000000000000001111111",
        "type": "percentage",
        "value": "10",
        "scope": {
          "type": "items",
          "ids": ["price_0000000000000000000000", "price_0000000000000001111111"]
        }
      }
    ]
  },
  "createdAt": "2024-01-01T00:00:00Z",
  "updatedAt": "2024-01-01T00:00:00Z",
  "canceledAt": null,
  "completedAt": null
}
id
string

The unique identifier for the subscription.

accountId
string

The identifier of the customer associated with the subscription.

name
string

The name of the subscription, e.g., "Waystar Royco - 2024".

description
string

A brief description of the subscription, such as "Initial contract for Waystar Royco".

purchaseOrderNumber
string

The purchase order number associated with this subscription.

contractStartDate
datetime

The effective start date and time of the contract in ISO 8601 format.

currency
string

The currency used for billing, e.g., "USD".

status
string

The current status of the subscription (e.g., draft, active).

activationMode
string

The activation mode for the subscription, such as manual or automatic.

currentVersion
object

Details regarding the current version of the subscription.

createdAt
datetime

The timestamp when the subscription was created.

updatedAt
datetime

The timestamp when the subscription was last updated.

canceledAt
datetime

The timestamp when the subscription was canceled. If the subscription is active, this field is null.

completedAt
datetime

The timestamp when the subscription was completed. If the subscription is still in progress, this field is null.