title: Subscriptions

description: Create, manage, and cancel API subscriptions.

Subscriptions

Subscriptions give your account access to a specific API in the marketplace. Manage them programmatically with these endpoints.


Create a subscription

Subscribe to a marketplace API.

POST /v1/subscriptions
ParameterTypeRequiredDescription
api_idstringYesID of the marketplace API to subscribe to.
plan_idstringYesID of the pricing plan.
metadataobjectNoArbitrary key-value pairs for your own tracking.
# cURL
curl https://api.wontopos.com/v1/subscriptions 
  -X POST 
  -H "Authorization: Bearer sk_live_your_key_here" 
  -H "Content-Type: application/json" 
  -d '{
    "api_id": "api_1a2b3c4d",
    "plan_id": "plan_pro"
  }'
// JavaScript
const res = await fetch("https://api.wontopos.com/v1/subscriptions", {
  method: "POST",
  headers: {
    Authorization: "Bearer sk_live_your_key_here",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    api_id: "api_1a2b3c4d",
    plan_id: "plan_pro",
  }),
});
# Python
import requests

resp = requests.post(
    "https://api.wontopos.com/v1/subscriptions",
    headers={"Authorization": "Bearer sk_live_your_key_here"},
    json={"api_id": "api_1a2b3c4d", "plan_id": "plan_pro"},
)

Response:

{
  "id": "sub_9x8y7z",
  "api_id": "api_1a2b3c4d",
  "plan_id": "plan_pro",
  "status": "active",
  "created_at": "2026-03-30T10:00:00Z",
  "current_period_end": "2026-04-30T10:00:00Z"
}

Billing

Charges begin immediately when a subscription is created. See [Billing](/docs/pricing/billing) for details.

List subscriptions

Returns all subscriptions for the authenticated account.

GET /v1/subscriptions
ParameterTypeDefaultDescription
statusstringFilter by status: active, cancelled, past_due.
api_idstringFilter by a specific API.
limitinteger20Maximum number of results.
offsetinteger0Pagination offset.

Response:

{
  "object": "list",
  "data": [
    {
      "id": "sub_9x8y7z",
      "api_id": "api_1a2b3c4d",
      "plan_id": "plan_pro",
      "status": "active",
      "created_at": "2026-03-30T10:00:00Z",
      "current_period_end": "2026-04-30T10:00:00Z"
    }
  ],
  "total": 3,
  "has_more": false
}

Cancel a subscription

Cancel an existing subscription by its ID.

DELETE /v1/subscriptions/:subscription_id
ParameterTypeRequiredDescription
subscription_idstringYesID of the subscription to cancel.
ParameterTypeDefaultDescription
cancel_at_period_endbooleanfalseIf true, access continues until the current billing period ends.
curl https://api.wontopos.com/v1/subscriptions/sub_9x8y7z?cancel_at_period_end=true 
  -X DELETE 
  -H "Authorization: Bearer sk_live_your_key_here"

Response:

{
  "id": "sub_9x8y7z",
  "status": "cancelled",
  "cancelled_at": "2026-03-30T15:00:00Z",
  "access_until": "2026-04-30T10:00:00Z"
}

Immediate cancellation

When `cancel_at_period_end` is `false` (the default), API access is revoked immediately. This action cannot be undone.