LogoLogo
  • Piriod API
  • Getting started
  • Integrations flows
  • Authentication
  • Error Handling
  • Pagination and Filtering
  • Core Resources
    • Customers
      • Create a customer
      • List customers
    • Contacts
    • Reminders
  • Billing
    • Products
    • Plans
    • Addons
    • Coupons
    • Subscriptions
    • Usages
    • Invoices
    • Credit Notes
    • Orders
  • Payments
    • Sources
    • Payments
  • Apps
    • Customer Base
      • Sessions
  • Collections
    • Documents
    • Currencies
    • Countries
    • States
Powered by GitBook
On this page

Was this helpful?

Authentication

Piriod uses Authorization HTTP header for authenticating the API calls. Add "Token your_token" to Authorization header in your API calls. The API key could be got from API Keys section in your user preferences page in the web client console.

Sample authentication:

For python you could specify the API key through headers params using requests library.

import requests

url = f'https://api.piriod.com/subscriptions/{id}/'
headers = {
  'Authorization': f'Token {api_key}'
}
r = requests.get(url=url, headers=headers)

print(r.json())

Organizations

Clients can make requests as organizations using the special header x-simple-workspace which should contain a Piriod organization ID, usually starting with the prefix acc_. The organization ID could be got from Organizations section in your user preferences page in the web client console.

Set organization ID to API calls:

The value is set per-request as shown in the adjacent code sample. Methods on the returned object reuse the same account ID.

import requests

url = f'https://api.piriod.com/subscription/{id}/'
headers = {
  'Authorization': f'Token {api_key}'
  'x-simple-workspace': organization_id
}
r = requests.get(url=url, headers=headers)

print(r.json())
PreviousIntegrations flowsNextError Handling

Last updated 4 years ago

Was this helpful?