Skip to main content
POST
Create subscription

Authorizations

Authorization
string
header
required

Use header Authorization: Token <api_token>. API tokens are obtained from the Piriod dashboard.

Headers

x-simple-workspace
string
required

Workspace (account) identifier. Required for every request.

x-piriod-test-mode
boolean
default:false

Whether to operate against test-mode data. Defaults to false.

Body

application/json
customer
string
required

Customer ID.

document
integer
required

Document type ID used to issue invoices.

date_start
string<date>
required
next_billing
string<date>
required
lines
object[]
required
previous_billing
string<date> | null
billing_cycles
integer | null

Total cycles or null for indefinite.

expiration_days
integer
default:10

Days until invoices generated by this subscription expire.

collection_scheme
enum<string>
default:send_invoice
Available options:
send_invoice,
charge_payment
default_source
string | null

Default payment source ID. Required when collection_scheme=charge_payment.

custom_change
number | null

Custom currency conversion factor for issued invoices.

Required range: x >= 1
coupon
string | null

Coupon ID applied at the subscription (invoice-level) scope.

require_reference
boolean
default:false
note
string | null
Maximum string length: 100
orgunit
integer | null
status_description
string | null
Maximum string length: 512
addons
object[]
references
object[]

Response

Subscription created.

customer
string
required

Customer ID.

document
integer
required

Document type ID used to issue invoices.

date_start
string<date>
required
next_billing
string<date>
required
lines
object[]
required
id
string
read-only
previous_billing
string<date> | null
billing_cycles
integer | null

Total cycles or null for indefinite.

next_billing_cycle
integer
default:1
read-only
expiration_days
integer
default:10

Days until invoices generated by this subscription expire.

collection_scheme
enum<string>
default:send_invoice
Available options:
send_invoice,
charge_payment
default_source
string | null

Default payment source ID. Required when collection_scheme=charge_payment.

custom_change
number | null

Custom currency conversion factor for issued invoices.

Required range: x >= 1
coupon
string | null

Coupon ID applied at the subscription (invoice-level) scope.

coupon_redemptions
integer
read-only
require_reference
boolean
default:false
note
string | null
Maximum string length: 100
orgunit
integer | null
status
enum<string>
read-only
Available options:
active,
paused,
cancelled,
finalized,
needs_attention
status_description
string | null
Maximum string length: 512
needs_attention
string<date-time> | null
read-only
needs_attention_reason
enum<string> | null
read-only
Available options:
biller_issue,
gateway_issue,
reference_expired,
without_usage_records,
processing_issue,
without_reference
cancel_reason
enum<string> | null
read-only
Available options:
custom,
fraud_review_failed,
insolvency,
no_card,
non_compliant_customer,
not_paid,
not_specified,
shutdown_ops
cancelled
string<date-time> | null
read-only
paused
string<date-time> | null
read-only
paused_reason
enum<string> | null
read-only
Available options:
not_specified,
non_compliant_customer,
custom
pause_until
string<date> | null
read-only
addons
object[]
references
object[]
test_mode
boolean
read-only
created
string<date-time>
read-only
updated
string<date-time>
read-only