POST
/
api
/
subscriptions
/
curl --request POST \
  --url https://api.uselotus.io/api/subscriptions/ \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
  "start_date": "2023-11-07T05:31:56Z",
  "end_date": "2023-11-07T05:31:56Z",
  "auto_renew": true,
  "is_new": true,
  "subscription_filters": [
    {
      "value": "<string>",
      "property_name": "<string>"
    }
  ],
  "customer_id": "<string>",
  "plan_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "component_fixed_charges_initial_units": [
    {
      "metric_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "units": 5000000000
    }
  ],
  "metadata": {}
}'
{
  "subscription_id": "<string>",
  "start_date": "2023-11-07T05:31:56Z",
  "end_date": "2023-11-07T05:31:56Z",
  "auto_renew": true,
  "is_new": true,
  "subscription_filters": [
    {
      "value": "<string>",
      "property_name": "<string>"
    }
  ],
  "customer": {
    "customer_name": "<string>",
    "email": "jsmith@example.com",
    "customer_id": "<string>"
  },
  "billing_plan": {
    "plan_name": "<string>",
    "plan_id": "<string>",
    "version_id": "<string>",
    "version": 123
  },
  "fully_billed": true,
  "addons": [
    {
      "addon_subscription_id": "<string>",
      "start_date": "2023-11-07T05:31:56Z",
      "end_date": "2023-11-07T05:31:56Z",
      "addon": {
        "addon_name": "<string>",
        "addon_id": "<string>",
        "addon_type": "flat",
        "billing_frequency": "one_time"
      },
      "fully_billed": true
    }
  ],
  "metadata": {}
}

A subscription associates one of your customers with one of your billing plans. You can safely give a customer multiple subscriptions to different plans.

If you want to give a single customer multiple subscriptions to the same plan (for example, one for each of their environments), you can do that using subscription_filters. For more details on how to use them and what they do, see the subscription filters documentation.

If any of your usage components has a prepaid charge associated with it, you can specify how many units they prepaid for as part of this call. If you don’t specify a value, the component’s default value will be used. If there was no default value, the susbcription creation will fail.

lotus.create_subscription(
  customer_id='cust_6c237d6c149c47db8f64246b78ecac13',
  plan_id='plan_f17c6153807d4f4b812265a09cf06680',
  start_date='2022-02-23 03:30:00+00:00',
)

Authorizations

Authorization
string
header
required

Token-based authentication with required prefix "Token"

Body

Response

201 - application/json

The response is of type object.