Next Commerce
Subscriptions

Subscriptions Lines Create

Create a new subscription line.

POST
/subscriptions/{id}/lines/

Authorization

oauth2 subscriptions:write
AuthorizationBearer <token>

Generate an Access Token through Settings > API Access for single store access or use the Authorization Code flow with your partner App Client ID. Use required permission scopes for API endpoint access. Example Authorization: Bearer 123

In: header

Scope: subscriptions:write

Path Parameters

id*integer

A unique integer value identifying the Subscription.

Header Parameters

X-29next-API-Version*string
Default"2023-02-10"
Value in"2023-02-10"

Request Body

metadata?|
price?string
Match^-?\d{0,10}(?:\.\d{0,2})?$
Formatdecimal
product_id*integer
quantity*integer

Response Body

application/json

curl -X POST "https://example.29next.store/api/admin/subscriptions/0/lines/" \
  -H "X-29next-API-Version: 2023-02-10" \
  -H "Authorization: Bearer " \
  -H "Content-Type: application/json" \
  -d '{
    "product_id": 0,
    "quantity": 0
  }'
{
  "id": 0,
  "metadata": {},
  "price": "string",
  "product": {
    "categories": [
      {
        "id": 0,
        "name": "string",
        "slug": "string"
      }
    ],
    "id": 0,
    "images": [
      {
        "attachment": "string",
        "caption": "string",
        "display_order": 2147483647,
        "file_name": "string",
        "id": 0,
        "src": "http://example.com"
      }
    ],
    "title": "string",
    "upc": "string",
    "url": "http://example.com"
  },
  "quantity": 2147483647,
  "stockrecord": {
    "id": 0,
    "low_stock_threshold": 2147483647,
    "num_allocated": -2147483648,
    "num_in_stock": -2147483648,
    "partner_sku": "string",
    "price": "string",
    "price_currency": "string",
    "price_retail": "string"
  }
}