Skip to main content
POST
/
subscriptions
Create Subscription
curl --request POST \
  --url https://api.atlas.co/functions/v1/subscriptions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "customer": "<string>",
  "items": [
    {
      "price": "<string>",
      "quantity": 1
    }
  ],
  "trial_period_days": 123,
  "trial_end": 123,
  "billing_cycle_anchor": 123,
  "cancel_at_period_end": true,
  "collection_method": "charge_automatically",
  "days_until_due": 123,
  "default_payment_method": "<string>",
  "metadata": {}
}
'
{
  "id": "<string>",
  "object": "subscription",
  "customer": "<string>",
  "status": "trialing",
  "current_period_start": 123,
  "current_period_end": 123,
  "trial_start": 123,
  "trial_end": 123,
  "cancel_at_period_end": true,
  "canceled_at": 123,
  "ended_at": 123,
  "collection_method": "<string>",
  "days_until_due": 123,
  "default_payment_method": "<string>",
  "items": {
    "object": "list",
    "data": [
      {
        "id": "<string>",
        "object": "subscription_item",
        "price": {
          "id": "<string>",
          "product": "<string>",
          "unit_amount": 123,
          "currency": "<string>",
          "recurring": {
            "interval": "<string>",
            "interval_count": 123
          }
        },
        "quantity": 123,
        "created": 123
      }
    ]
  },
  "latest_invoice": "<string>",
  "metadata": {},
  "created": 123
}

Authorizations

Authorization
string
header
required

API key (sk_test_* or sk_live_*)

Body

application/json
customer
string
required
items
object[]
required
trial_period_days
integer
trial_end
integer
billing_cycle_anchor
integer
cancel_at_period_end
boolean
collection_method
enum<string>
Available options:
charge_automatically,
send_invoice
days_until_due
integer
default_payment_method
string
metadata
object

Response

Subscription created

id
string
object
enum<string>
Available options:
subscription
customer
string
status
enum<string>
Available options:
trialing,
active,
past_due,
paused,
canceled,
unpaid
current_period_start
integer
current_period_end
integer
trial_start
integer
trial_end
integer
cancel_at_period_end
boolean
canceled_at
integer
ended_at
integer
collection_method
string
days_until_due
integer
default_payment_method
string
items
object
latest_invoice
string
metadata
object
created
integer