curl --request POST \
--url https://api.piriod.com/subscriptions/ \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'x-simple-workspace: <x-simple-workspace>' \
--data '
{
"customer": "<string>",
"document": 123,
"date_start": "2023-12-25",
"next_billing": "2023-12-25",
"lines": [
{
"plan": "<string>",
"quantity": 2,
"coupon": "<string>"
}
],
"previous_billing": "2023-12-25",
"billing_cycles": 123,
"expiration_days": 10,
"collection_scheme": "send_invoice",
"default_source": "<string>",
"custom_change": 2,
"coupon": "<string>",
"require_reference": false,
"note": "<string>",
"orgunit": 123,
"status_description": "<string>",
"addons": [
{
"addon": "<string>",
"quantity": 2,
"rates": [
{
"billing_cycle": 123,
"percentage": 123,
"description": "<string>"
}
]
}
],
"references": [
{
"date": "2023-12-25",
"document": "<string>",
"serial": "<string>",
"date_end": "2023-12-25",
"description": "<string>"
}
]
}
'import requests
url = "https://api.piriod.com/subscriptions/"
payload = {
"customer": "<string>",
"document": 123,
"date_start": "2023-12-25",
"next_billing": "2023-12-25",
"lines": [
{
"plan": "<string>",
"quantity": 2,
"coupon": "<string>"
}
],
"previous_billing": "2023-12-25",
"billing_cycles": 123,
"expiration_days": 10,
"collection_scheme": "send_invoice",
"default_source": "<string>",
"custom_change": 2,
"coupon": "<string>",
"require_reference": False,
"note": "<string>",
"orgunit": 123,
"status_description": "<string>",
"addons": [
{
"addon": "<string>",
"quantity": 2,
"rates": [
{
"billing_cycle": 123,
"percentage": 123,
"description": "<string>"
}
]
}
],
"references": [
{
"date": "2023-12-25",
"document": "<string>",
"serial": "<string>",
"date_end": "2023-12-25",
"description": "<string>"
}
]
}
headers = {
"x-simple-workspace": "<x-simple-workspace>",
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-simple-workspace': '<x-simple-workspace>',
Authorization: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
customer: '<string>',
document: 123,
date_start: '2023-12-25',
next_billing: '2023-12-25',
lines: [{plan: '<string>', quantity: 2, coupon: '<string>'}],
previous_billing: '2023-12-25',
billing_cycles: 123,
expiration_days: 10,
collection_scheme: 'send_invoice',
default_source: '<string>',
custom_change: 2,
coupon: '<string>',
require_reference: false,
note: '<string>',
orgunit: 123,
status_description: '<string>',
addons: [
{
addon: '<string>',
quantity: 2,
rates: [{billing_cycle: 123, percentage: 123, description: '<string>'}]
}
],
references: [
{
date: '2023-12-25',
document: '<string>',
serial: '<string>',
date_end: '2023-12-25',
description: '<string>'
}
]
})
};
fetch('https://api.piriod.com/subscriptions/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.piriod.com/subscriptions/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'customer' => '<string>',
'document' => 123,
'date_start' => '2023-12-25',
'next_billing' => '2023-12-25',
'lines' => [
[
'plan' => '<string>',
'quantity' => 2,
'coupon' => '<string>'
]
],
'previous_billing' => '2023-12-25',
'billing_cycles' => 123,
'expiration_days' => 10,
'collection_scheme' => 'send_invoice',
'default_source' => '<string>',
'custom_change' => 2,
'coupon' => '<string>',
'require_reference' => false,
'note' => '<string>',
'orgunit' => 123,
'status_description' => '<string>',
'addons' => [
[
'addon' => '<string>',
'quantity' => 2,
'rates' => [
[
'billing_cycle' => 123,
'percentage' => 123,
'description' => '<string>'
]
]
]
],
'references' => [
[
'date' => '2023-12-25',
'document' => '<string>',
'serial' => '<string>',
'date_end' => '2023-12-25',
'description' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"x-simple-workspace: <x-simple-workspace>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.piriod.com/subscriptions/"
payload := strings.NewReader("{\n \"customer\": \"<string>\",\n \"document\": 123,\n \"date_start\": \"2023-12-25\",\n \"next_billing\": \"2023-12-25\",\n \"lines\": [\n {\n \"plan\": \"<string>\",\n \"quantity\": 2,\n \"coupon\": \"<string>\"\n }\n ],\n \"previous_billing\": \"2023-12-25\",\n \"billing_cycles\": 123,\n \"expiration_days\": 10,\n \"collection_scheme\": \"send_invoice\",\n \"default_source\": \"<string>\",\n \"custom_change\": 2,\n \"coupon\": \"<string>\",\n \"require_reference\": false,\n \"note\": \"<string>\",\n \"orgunit\": 123,\n \"status_description\": \"<string>\",\n \"addons\": [\n {\n \"addon\": \"<string>\",\n \"quantity\": 2,\n \"rates\": [\n {\n \"billing_cycle\": 123,\n \"percentage\": 123,\n \"description\": \"<string>\"\n }\n ]\n }\n ],\n \"references\": [\n {\n \"date\": \"2023-12-25\",\n \"document\": \"<string>\",\n \"serial\": \"<string>\",\n \"date_end\": \"2023-12-25\",\n \"description\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-simple-workspace", "<x-simple-workspace>")
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.piriod.com/subscriptions/")
.header("x-simple-workspace", "<x-simple-workspace>")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"customer\": \"<string>\",\n \"document\": 123,\n \"date_start\": \"2023-12-25\",\n \"next_billing\": \"2023-12-25\",\n \"lines\": [\n {\n \"plan\": \"<string>\",\n \"quantity\": 2,\n \"coupon\": \"<string>\"\n }\n ],\n \"previous_billing\": \"2023-12-25\",\n \"billing_cycles\": 123,\n \"expiration_days\": 10,\n \"collection_scheme\": \"send_invoice\",\n \"default_source\": \"<string>\",\n \"custom_change\": 2,\n \"coupon\": \"<string>\",\n \"require_reference\": false,\n \"note\": \"<string>\",\n \"orgunit\": 123,\n \"status_description\": \"<string>\",\n \"addons\": [\n {\n \"addon\": \"<string>\",\n \"quantity\": 2,\n \"rates\": [\n {\n \"billing_cycle\": 123,\n \"percentage\": 123,\n \"description\": \"<string>\"\n }\n ]\n }\n ],\n \"references\": [\n {\n \"date\": \"2023-12-25\",\n \"document\": \"<string>\",\n \"serial\": \"<string>\",\n \"date_end\": \"2023-12-25\",\n \"description\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.piriod.com/subscriptions/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-simple-workspace"] = '<x-simple-workspace>'
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customer\": \"<string>\",\n \"document\": 123,\n \"date_start\": \"2023-12-25\",\n \"next_billing\": \"2023-12-25\",\n \"lines\": [\n {\n \"plan\": \"<string>\",\n \"quantity\": 2,\n \"coupon\": \"<string>\"\n }\n ],\n \"previous_billing\": \"2023-12-25\",\n \"billing_cycles\": 123,\n \"expiration_days\": 10,\n \"collection_scheme\": \"send_invoice\",\n \"default_source\": \"<string>\",\n \"custom_change\": 2,\n \"coupon\": \"<string>\",\n \"require_reference\": false,\n \"note\": \"<string>\",\n \"orgunit\": 123,\n \"status_description\": \"<string>\",\n \"addons\": [\n {\n \"addon\": \"<string>\",\n \"quantity\": 2,\n \"rates\": [\n {\n \"billing_cycle\": 123,\n \"percentage\": 123,\n \"description\": \"<string>\"\n }\n ]\n }\n ],\n \"references\": [\n {\n \"date\": \"2023-12-25\",\n \"document\": \"<string>\",\n \"serial\": \"<string>\",\n \"date_end\": \"2023-12-25\",\n \"description\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"customer": "<string>",
"document": 123,
"date_start": "2023-12-25",
"next_billing": "2023-12-25",
"lines": [
{
"plan": "<string>",
"quantity": 2,
"id": "<string>",
"coupon": "<string>",
"coupon_redemptions": 123,
"created": "2023-11-07T05:31:56Z",
"updated": "2023-11-07T05:31:56Z"
}
],
"id": "<string>",
"previous_billing": "2023-12-25",
"billing_cycles": 123,
"next_billing_cycle": 1,
"expiration_days": 10,
"collection_scheme": "send_invoice",
"default_source": "<string>",
"custom_change": 2,
"coupon": "<string>",
"coupon_redemptions": 123,
"require_reference": false,
"note": "<string>",
"orgunit": 123,
"status_description": "<string>",
"needs_attention": "2023-11-07T05:31:56Z",
"cancelled": "2023-11-07T05:31:56Z",
"paused": "2023-11-07T05:31:56Z",
"pause_until": "2023-12-25",
"addons": [
{
"addon": "<string>",
"quantity": 2,
"addon_redemptions": 123,
"rates": [
{
"billing_cycle": 123,
"percentage": 123,
"description": "<string>"
}
]
}
],
"references": [
{
"date": "2023-12-25",
"document": "<string>",
"serial": "<string>",
"date_end": "2023-12-25",
"description": "<string>"
}
],
"test_mode": true,
"created": "2023-11-07T05:31:56Z",
"updated": "2023-11-07T05:31:56Z"
}{
"name": [
"This field is required."
],
"non_field_errors": [
"x-simple-workspace header is required."
]
}Create subscription
curl --request POST \
--url https://api.piriod.com/subscriptions/ \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'x-simple-workspace: <x-simple-workspace>' \
--data '
{
"customer": "<string>",
"document": 123,
"date_start": "2023-12-25",
"next_billing": "2023-12-25",
"lines": [
{
"plan": "<string>",
"quantity": 2,
"coupon": "<string>"
}
],
"previous_billing": "2023-12-25",
"billing_cycles": 123,
"expiration_days": 10,
"collection_scheme": "send_invoice",
"default_source": "<string>",
"custom_change": 2,
"coupon": "<string>",
"require_reference": false,
"note": "<string>",
"orgunit": 123,
"status_description": "<string>",
"addons": [
{
"addon": "<string>",
"quantity": 2,
"rates": [
{
"billing_cycle": 123,
"percentage": 123,
"description": "<string>"
}
]
}
],
"references": [
{
"date": "2023-12-25",
"document": "<string>",
"serial": "<string>",
"date_end": "2023-12-25",
"description": "<string>"
}
]
}
'import requests
url = "https://api.piriod.com/subscriptions/"
payload = {
"customer": "<string>",
"document": 123,
"date_start": "2023-12-25",
"next_billing": "2023-12-25",
"lines": [
{
"plan": "<string>",
"quantity": 2,
"coupon": "<string>"
}
],
"previous_billing": "2023-12-25",
"billing_cycles": 123,
"expiration_days": 10,
"collection_scheme": "send_invoice",
"default_source": "<string>",
"custom_change": 2,
"coupon": "<string>",
"require_reference": False,
"note": "<string>",
"orgunit": 123,
"status_description": "<string>",
"addons": [
{
"addon": "<string>",
"quantity": 2,
"rates": [
{
"billing_cycle": 123,
"percentage": 123,
"description": "<string>"
}
]
}
],
"references": [
{
"date": "2023-12-25",
"document": "<string>",
"serial": "<string>",
"date_end": "2023-12-25",
"description": "<string>"
}
]
}
headers = {
"x-simple-workspace": "<x-simple-workspace>",
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-simple-workspace': '<x-simple-workspace>',
Authorization: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
customer: '<string>',
document: 123,
date_start: '2023-12-25',
next_billing: '2023-12-25',
lines: [{plan: '<string>', quantity: 2, coupon: '<string>'}],
previous_billing: '2023-12-25',
billing_cycles: 123,
expiration_days: 10,
collection_scheme: 'send_invoice',
default_source: '<string>',
custom_change: 2,
coupon: '<string>',
require_reference: false,
note: '<string>',
orgunit: 123,
status_description: '<string>',
addons: [
{
addon: '<string>',
quantity: 2,
rates: [{billing_cycle: 123, percentage: 123, description: '<string>'}]
}
],
references: [
{
date: '2023-12-25',
document: '<string>',
serial: '<string>',
date_end: '2023-12-25',
description: '<string>'
}
]
})
};
fetch('https://api.piriod.com/subscriptions/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.piriod.com/subscriptions/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'customer' => '<string>',
'document' => 123,
'date_start' => '2023-12-25',
'next_billing' => '2023-12-25',
'lines' => [
[
'plan' => '<string>',
'quantity' => 2,
'coupon' => '<string>'
]
],
'previous_billing' => '2023-12-25',
'billing_cycles' => 123,
'expiration_days' => 10,
'collection_scheme' => 'send_invoice',
'default_source' => '<string>',
'custom_change' => 2,
'coupon' => '<string>',
'require_reference' => false,
'note' => '<string>',
'orgunit' => 123,
'status_description' => '<string>',
'addons' => [
[
'addon' => '<string>',
'quantity' => 2,
'rates' => [
[
'billing_cycle' => 123,
'percentage' => 123,
'description' => '<string>'
]
]
]
],
'references' => [
[
'date' => '2023-12-25',
'document' => '<string>',
'serial' => '<string>',
'date_end' => '2023-12-25',
'description' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"x-simple-workspace: <x-simple-workspace>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.piriod.com/subscriptions/"
payload := strings.NewReader("{\n \"customer\": \"<string>\",\n \"document\": 123,\n \"date_start\": \"2023-12-25\",\n \"next_billing\": \"2023-12-25\",\n \"lines\": [\n {\n \"plan\": \"<string>\",\n \"quantity\": 2,\n \"coupon\": \"<string>\"\n }\n ],\n \"previous_billing\": \"2023-12-25\",\n \"billing_cycles\": 123,\n \"expiration_days\": 10,\n \"collection_scheme\": \"send_invoice\",\n \"default_source\": \"<string>\",\n \"custom_change\": 2,\n \"coupon\": \"<string>\",\n \"require_reference\": false,\n \"note\": \"<string>\",\n \"orgunit\": 123,\n \"status_description\": \"<string>\",\n \"addons\": [\n {\n \"addon\": \"<string>\",\n \"quantity\": 2,\n \"rates\": [\n {\n \"billing_cycle\": 123,\n \"percentage\": 123,\n \"description\": \"<string>\"\n }\n ]\n }\n ],\n \"references\": [\n {\n \"date\": \"2023-12-25\",\n \"document\": \"<string>\",\n \"serial\": \"<string>\",\n \"date_end\": \"2023-12-25\",\n \"description\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-simple-workspace", "<x-simple-workspace>")
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.piriod.com/subscriptions/")
.header("x-simple-workspace", "<x-simple-workspace>")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"customer\": \"<string>\",\n \"document\": 123,\n \"date_start\": \"2023-12-25\",\n \"next_billing\": \"2023-12-25\",\n \"lines\": [\n {\n \"plan\": \"<string>\",\n \"quantity\": 2,\n \"coupon\": \"<string>\"\n }\n ],\n \"previous_billing\": \"2023-12-25\",\n \"billing_cycles\": 123,\n \"expiration_days\": 10,\n \"collection_scheme\": \"send_invoice\",\n \"default_source\": \"<string>\",\n \"custom_change\": 2,\n \"coupon\": \"<string>\",\n \"require_reference\": false,\n \"note\": \"<string>\",\n \"orgunit\": 123,\n \"status_description\": \"<string>\",\n \"addons\": [\n {\n \"addon\": \"<string>\",\n \"quantity\": 2,\n \"rates\": [\n {\n \"billing_cycle\": 123,\n \"percentage\": 123,\n \"description\": \"<string>\"\n }\n ]\n }\n ],\n \"references\": [\n {\n \"date\": \"2023-12-25\",\n \"document\": \"<string>\",\n \"serial\": \"<string>\",\n \"date_end\": \"2023-12-25\",\n \"description\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.piriod.com/subscriptions/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-simple-workspace"] = '<x-simple-workspace>'
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customer\": \"<string>\",\n \"document\": 123,\n \"date_start\": \"2023-12-25\",\n \"next_billing\": \"2023-12-25\",\n \"lines\": [\n {\n \"plan\": \"<string>\",\n \"quantity\": 2,\n \"coupon\": \"<string>\"\n }\n ],\n \"previous_billing\": \"2023-12-25\",\n \"billing_cycles\": 123,\n \"expiration_days\": 10,\n \"collection_scheme\": \"send_invoice\",\n \"default_source\": \"<string>\",\n \"custom_change\": 2,\n \"coupon\": \"<string>\",\n \"require_reference\": false,\n \"note\": \"<string>\",\n \"orgunit\": 123,\n \"status_description\": \"<string>\",\n \"addons\": [\n {\n \"addon\": \"<string>\",\n \"quantity\": 2,\n \"rates\": [\n {\n \"billing_cycle\": 123,\n \"percentage\": 123,\n \"description\": \"<string>\"\n }\n ]\n }\n ],\n \"references\": [\n {\n \"date\": \"2023-12-25\",\n \"document\": \"<string>\",\n \"serial\": \"<string>\",\n \"date_end\": \"2023-12-25\",\n \"description\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"customer": "<string>",
"document": 123,
"date_start": "2023-12-25",
"next_billing": "2023-12-25",
"lines": [
{
"plan": "<string>",
"quantity": 2,
"id": "<string>",
"coupon": "<string>",
"coupon_redemptions": 123,
"created": "2023-11-07T05:31:56Z",
"updated": "2023-11-07T05:31:56Z"
}
],
"id": "<string>",
"previous_billing": "2023-12-25",
"billing_cycles": 123,
"next_billing_cycle": 1,
"expiration_days": 10,
"collection_scheme": "send_invoice",
"default_source": "<string>",
"custom_change": 2,
"coupon": "<string>",
"coupon_redemptions": 123,
"require_reference": false,
"note": "<string>",
"orgunit": 123,
"status_description": "<string>",
"needs_attention": "2023-11-07T05:31:56Z",
"cancelled": "2023-11-07T05:31:56Z",
"paused": "2023-11-07T05:31:56Z",
"pause_until": "2023-12-25",
"addons": [
{
"addon": "<string>",
"quantity": 2,
"addon_redemptions": 123,
"rates": [
{
"billing_cycle": 123,
"percentage": 123,
"description": "<string>"
}
]
}
],
"references": [
{
"date": "2023-12-25",
"document": "<string>",
"serial": "<string>",
"date_end": "2023-12-25",
"description": "<string>"
}
],
"test_mode": true,
"created": "2023-11-07T05:31:56Z",
"updated": "2023-11-07T05:31:56Z"
}{
"name": [
"This field is required."
],
"non_field_errors": [
"x-simple-workspace header is required."
]
}Authorizations
Use header Authorization: Token <api_token>.
API tokens are obtained from the Piriod dashboard.
Headers
Workspace (account) identifier. Required for every request.
Whether to operate against test-mode data. Defaults to false.
Body
Customer ID.
Document type ID used to issue invoices.
Show child attributes
Show child attributes
Total cycles or null for indefinite.
Days until invoices generated by this subscription expire.
send_invoice, charge_payment Default payment source ID. Required when collection_scheme=charge_payment.
Custom currency conversion factor for issued invoices.
x >= 1Coupon ID applied at the subscription (invoice-level) scope.
100512Show child attributes
Show child attributes
Show child attributes
Show child attributes
Response
Subscription created.
Customer ID.
Document type ID used to issue invoices.
Show child attributes
Show child attributes
Total cycles or null for indefinite.
Days until invoices generated by this subscription expire.
send_invoice, charge_payment Default payment source ID. Required when collection_scheme=charge_payment.
Custom currency conversion factor for issued invoices.
x >= 1Coupon ID applied at the subscription (invoice-level) scope.
100active, paused, cancelled, finalized, needs_attention 512biller_issue, gateway_issue, reference_expired, without_usage_records, processing_issue, without_reference custom, fraud_review_failed, insolvency, no_card, non_compliant_customer, not_paid, not_specified, shutdown_ops not_specified, non_compliant_customer, custom Show child attributes
Show child attributes
Show child attributes
Show child attributes
