Skip to main content
POST
/
external
/
subscriptions
Create subscription
curl --request POST \
  --url https://platform.runonatlas.com/external/subscriptions \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "startDate": "2021-01-01T00:00:00.000Z",
  "autoChargeInvoice": false,
  "autoSyncInvoice": true,
  "autoSendInvoice": true,
  "customerId": "atlas-internal-customer-id-123",
  "planId": "atlas-internal-plan-id-123",
  "currency": "USD",
  "endDate": "2021-12-31T00:00:00.000Z",
  "netTerms": "net30",
  "allowCustomerChanges": true,
  "paymentGateway": "Stripe",
  "invoiceGenerationStartDate": "2021-01-01T00:00:00.000Z"
}
'
{
  "createdAt": "2021-01-01T00:00:00.000Z",
  "id": "atlas-internal-subscription-id-123",
  "startDate": "2021-01-01T00:00:00.000Z",
  "status": "active",
  "updatedAt": "2021-01-01T00:00:00.000Z",
  "allowCustomerChanges": true,
  "autoChargeInvoice": false,
  "autoSyncInvoice": true,
  "autoSendInvoice": true,
  "paymentGateway": "Stripe",
  "isTrial": false,
  "customerId": "atlas-internal-customer-id-123",
  "planId": "atlas-internal-plan-id-123",
  "merchantId": "atlas-internal-merchant-id-123",
  "billingCadence": "monthly",
  "currency": "USD",
  "endDate": "2021-12-31T00:00:00.000Z",
  "netTerms": "net30",
  "chargeForUsageBasedPricesDuringTrial": false
}

Authorizations

x-api-key
string
header
required

You can obtain this key from the Atlas dashboard. It must be of type secret

Body

application/json
startDate
required

The start date of the subscription

Example:

"2021-01-01T00:00:00.000Z"

autoChargeInvoice
boolean
required

Whether to automatically charge invoices for this subscription to the associated payment gateway. Requires a valid Stripe connection. Only compatible with a Stripe payment gateway.

Example:

false

autoSyncInvoice
boolean
required

Whether to automatically sync invoices for this subscription to the associated payment gateway.

Example:

true

autoSendInvoice
boolean
required

Whether to automatically send invoices for this subscription from the associated payment gateway to the customers email address.

Example:

true

customerId
string
required

The Atlas customer ID

Minimum string length: 1
Example:

"atlas-internal-customer-id-123"

planId
string
required

The Atlas plan ID

Minimum string length: 1
Example:

"atlas-internal-plan-id-123"

currency
enum<string> | null

The currency for this subscription

Available options:
USD
Example:

"USD"

endDate

The end date of the subscription

Example:

"2021-12-31T00:00:00.000Z"

netTerms
enum<string> | null

The net terms for this subscription; applies only if autoChargeInvoice is false. Determines the number of days after the invoice is issued before the payment is due.

Available options:
uponReceipt,
net30,
net60,
net90
Example:

"net30"

allowCustomerChanges
boolean
default:true

Whether the customer can change the subscription, for example by cancelling it or creating another.

Example:

true

paymentGateway
enum<string> | null

The selected payment gateway for this subscription

Available options:
Stripe,
QuickBooks,
Xero
Example:

"Stripe"

invoiceGenerationStartDate

The date from which invoices should be generated. If ommitted, invoices will be generated from the subscription startDate. If set, no invoices will be generated until this date.

Example:

"2021-01-01T00:00:00.000Z"

Response

The subscription that has been created.

createdAt
string<date>
required

The date and time the subscription was created

Example:

"2021-01-01T00:00:00.000Z"

id
string
required

The Atlas subscription ID

Minimum string length: 1
Example:

"atlas-internal-subscription-id-123"

startDate
required

The start date of the subscription

Example:

"2021-01-01T00:00:00.000Z"

status
enum<string>
required

The status of the subscription

Available options:
draft,
pendingActivation,
active,
ended,
deleted
Example:

"active"

updatedAt
string<date>
required

The date and time the subscription was last updated

Example:

"2021-01-01T00:00:00.000Z"

allowCustomerChanges
boolean
required

Whether the customer can change the subscription, for example by cancelling it or creating another.

Example:

true

autoChargeInvoice
boolean
required

Whether to automatically charge invoices for this subscription to the associated payment gateway. Requires a valid Stripe connection. Only compatible with a Stripe payment gateway.

Example:

false

autoSyncInvoice
boolean
required

Whether to automatically sync invoices for this subscription to the associated payment gateway.

Example:

true

autoSendInvoice
boolean
required

Whether to automatically send invoices for this subscription from the associated payment gateway to the customers email address.

Example:

true

paymentGateway
enum<string> | null
required

The selected payment gateway for this subscription

Available options:
Stripe,
QuickBooks,
Xero
Example:

"Stripe"

isTrial
boolean
required

Whether this subscription is a trial subscription

Example:

false

customerId
string
required

The Atlas customer ID

Minimum string length: 1
Example:

"atlas-internal-customer-id-123"

planId
string
required

The Atlas plan ID

Minimum string length: 1
Example:

"atlas-internal-plan-id-123"

merchantId
string
required

The Atlas merchant ID

Minimum string length: 1
Example:

"atlas-internal-merchant-id-123"

billingCadence
enum<string> | null

The billing cadence for this subscription

Available options:
oneTime,
monthly,
quarterly,
annually
Example:

"monthly"

currency
enum<string> | null

The currency for this subscription

Available options:
USD
Example:

"USD"

endDate

The end date of the subscription

Example:

"2021-12-31T00:00:00.000Z"

netTerms
enum<string> | null

The net terms for this subscription; applies only if autoChargeInvoice is false. Determines the number of days after the invoice is issued before the payment is due.

Available options:
uponReceipt,
net30,
net60,
net90
Example:

"net30"

chargeForUsageBasedPricesDuringTrial
boolean | null

Whether to charge for usage-based prices during the trial period. Only applies if isTrial is true.

Example:

false