Skip to content
Get started

Create

POST/products

Creates a new product

Body ParametersJSONExpand Collapse
code: string

Product code (unique identifier)

description: string

Description of the product

Accepts one of the following:
Accepts one of the following:
ReturnsExpand Collapse
data: object { id, code, created, 5 more }

Product object

id: string

Unique identifier for the product

code: string

User-defined product identifier.

created: string

ISO 8601 timestamp when the product was created

formatdate-time
description: string

Description of the product

updateVersion: number

Version number for optimistic locking

workspaceId: string

Workspace ID this product belongs to

Create

curl https://api.us-west-2.fragment.dev/products \
    -H 'Content-Type: application/json' \
    -d '{
          "code": "PROD_001",
          "description": "Premium subscription service",
          "paid_by_roles": [
            {
              "name": "buyer"
            }
          ],
          "paid_to_roles": [
            {
              "name": "seller"
            }
          ]
        }'
{
  "data": {
    "id": "product_1234567890",
    "code": "PROD_001",
    "created": "2024-01-13T00:00:00Z",
    "description": "Premium subscription service",
    "paid_by_roles": [
      {
        "id": "role_def123",
        "name": "buyer"
      }
    ],
    "paid_to_roles": [
      {
        "id": "role_def123",
        "name": "buyer"
      }
    ],
    "updateVersion": 1,
    "workspaceId": "ws_1234567890"
  }
}
Returns Examples
{
  "data": {
    "id": "product_1234567890",
    "code": "PROD_001",
    "created": "2024-01-13T00:00:00Z",
    "description": "Premium subscription service",
    "paid_by_roles": [
      {
        "id": "role_def123",
        "name": "buyer"
      }
    ],
    "paid_to_roles": [
      {
        "id": "role_def123",
        "name": "buyer"
      }
    ],
    "updateVersion": 1,
    "workspaceId": "ws_1234567890"
  }
}