Skip to main content
POST
/
payments
/
subscriptions
Create Subscription
curl --request POST \
  --url https://api.rootfi.dev/v4/payments/subscriptions \
  --header 'Content-Type: application/json' \
  --header 'api_key: <api-key>' \
  --data '
{
  "company_id": 123,
  "contact_id": "<string>",
  "currency_id": "<string>",
  "amount": 123,
  "interval": "DAY",
  "interval_count": 123,
  "status": "ACTIVE",
  "items": [
    {
      "description": "<string>",
      "quantity": 123,
      "unit_amount": 123,
      "item_id": "<string>"
    }
  ]
}
'
{
  "rootfi_id": 157,
  "rootfi_created_at": "2024-01-22T05:07:31.465Z",
  "rootfi_updated_at": "2024-01-22T05:07:31.000Z",
  "rootfi_company_id": 1089,
  "platform_id": "123456",
  "rootfi_deleted_at": "2023-11-07T05:31:56Z",
  "platform_unique_id": "<string>",
  "raw_data": {},
  "data_hash": "<string>",
  "contact_id": "<string>",
  "currency_id": "<string>",
  "status": "ACTIVE",
  "amount": 123,
  "interval": "DAY",
  "interval_count": 123,
  "next_billing_date": "<string>",
  "last_invoice_date": "<string>",
  "last_payment_date": "<string>",
  "created_at": "<string>",
  "updated_at": "<string>",
  "invoice_ids": [
    "<string>"
  ],
  "transaction_ids": [
    "<string>"
  ],
  "items": [
    {
      "rootfi_id": 123,
      "item_id": "<string>",
      "description": "<string>",
      "quantity": 123,
      "unit_amount": 123
    }
  ]
}
Create a new subscription for recurring billing. Subscriptions automatically generate invoices at regular intervals.

Request Body

FieldTypeRequiredDescription
contact_idstringYesReference to the Contact
currency_idstringYesISO 4217 currency code
amountnumberYesRecurring charge amount per billing cycle
intervalstringYesBilling frequency: DAY, WEEK, MONTH, YEAR
interval_countintegerNoIntervals between billings (default: 1)
statusstringNoInitial status: ACTIVE, IN_TRIAL (default: ACTIVE)
itemsarrayNoProducts/services in the subscription

Subscription Item Fields

FieldTypeRequiredDescription
item_idstringNoReference to an Item/Product
descriptionstringYesDescription of the subscribed service
quantityintegerYesNumber of units
unit_amountnumberYesPrice per unit
See Subscription Overview for complete field details.

Authorizations

api_key
string
header
required

Body

application/json
company_id
integer
required
contact_id
string
required
currency_id
string
required
amount
number<double>
required
interval
enum<string>
required
Available options:
DAY,
WEEK,
MONTH,
YEAR
interval_count
integer | null
status
enum<string> | null
Available options:
ACTIVE,
IN_TRIAL,
CANCELED,
PAUSED,
PAST_DUE,
INCOMPLETE,
UNKNOWN
items
paymentsV4SubscriptionItemCreate · object[] | null

Response

Subscription created successfully

V4 Subscription model for recurring billing arrangements.

rootfi_id
number<double>
required

The unique ID we assign for that data's information

Example:

157

rootfi_created_at
string<date-time>
required

The date at which RootFi first synced this data

Example:

"2024-01-22T05:07:31.465Z"

rootfi_updated_at
string<date-time>
required

The latest date at which RootFi updated this data

Example:

"2024-01-22T05:07:31.000Z"

rootfi_company_id
number<double>
required

The ID of the company in the accounting platform

Example:

1089

platform_id
string
required

An unique custom RootFi ID made from platform's unique_id.

Example:

"123456"

rootfi_deleted_at
string<date-time> | null

The date at which the data was deleted in the accounting platform

platform_unique_id
string | null

The ID of the data in the accounting platform.

raw_data
object

A JSON containing fields that you can directly get from the accounting platform.

data_hash
string | null

The hash of the data

contact_id
string | null

Reference to the Contact subscribed.

currency_id
string | null

ISO 4217 currency code for subscription charges.

status
enum<string> | null

Current status of the subscription (ACTIVE, IN_TRIAL, CANCELED, PAUSED, PAST_DUE, INCOMPLETE, UNKNOWN).

Available options:
ACTIVE,
IN_TRIAL,
CANCELED,
PAUSED,
PAST_DUE,
INCOMPLETE,
UNKNOWN
amount
number<double> | null

Recurring charge amount per billing cycle.

interval
enum<string> | null

Billing frequency unit (DAY, WEEK, MONTH, YEAR).

Available options:
DAY,
WEEK,
MONTH,
YEAR
interval_count
integer | null

Number of intervals between billings (e.g., 2 = every 2 months).

next_billing_date
string | null

Next scheduled billing date (ISO 8601).

last_invoice_date
string | null

Date when the last invoice was generated (ISO 8601).

last_payment_date
string | null

Date when the last successful payment was received (ISO 8601).

created_at
string | null

Original creation timestamp from platform (ISO 8601).

updated_at
string | null

Last update timestamp from platform (ISO 8601).

invoice_ids
string[] | null

References to all invoices generated from this subscription.

transaction_ids
string[] | null

References to all transactions (payments, refunds, fees).

items
paymentsV4SubscriptionItem · object[] | null

Products/services included in this subscription.