Products API

await accend.products.create({
  name: "Pro Plan",
  type: "subscription"
});

Endpoints

  • POST /v1/products
  • GET /v1/products
  • GET /v1/products/{productId}
  • PATCH /v1/products/{productId}
  • POST /v1/products/{productId}/archive

POST /v1/products

Scopes: write
Idempotency-Key: required
{
  "name": "Pro Plan",
  "type": "subscription",
  "description": "Monthly plan with unlimited requests.",
  "metadata": { "internal_id": "plan_pro" },
  "defaultPrice": {
    "amount": "9700",
    "currency": "BRL",
    "model": "subscription",
    "interval": "month"
  }
}
  • name string required
  • type enum required: subscription | one_time | metered | credit_pack
  • description string optional
  • metadata object optional (max 50 keys)
  • defaultPrice object optional
  • defaultPrice.amount string required when defaultPrice is set
  • defaultPrice.currency enum required: BRL | USDC
  • defaultPrice.model enum required: one_time | subscription | metered | credits
  • defaultPrice.interval enum conditional: month | year when model=subscription
Response 201
{
  "data": {
    "id": "prod_abc123",
    "name": "Pro Plan",
    "type": "subscription",
    "description": "Monthly plan with unlimited requests.",
    "status": "active",
    "metadata": { "internal_id": "plan_pro" },
    "defaultPrice": {
      "id": "price_abc123",
      "amount": "9700",
      "currency": "BRL",
      "model": "subscription",
      "interval": "month"
    },
    "createdAt": "2025-01-15T10:00:00Z"
  },
  "error": null,
  "success": true
}

GET /v1/products

Scopes: read Query params:
  • status enum: active | archived
  • limit int (default 100, max 500)
  • before string (cursor)
Response 200
{
  "data": {
    "items": [
      {
        "id": "prod_abc123",
        "name": "Pro Plan",
        "type": "subscription",
        "status": "active",
        "createdAt": "2025-01-15T10:00:00Z"
      }
    ],
    "hasMore": true,
    "nextCursor": "cur_xyz"
  },
  "error": null,
  "success": true
}

GET /v1/products/

Scopes: read Response 200
{
  "data": {
    "id": "prod_abc123",
    "name": "Pro Plan",
    "type": "subscription",
    "status": "active",
    "description": "Monthly plan with unlimited requests.",
    "metadata": {},
    "prices": [
      {
        "id": "price_abc123",
        "amount": "9700",
        "currency": "BRL",
        "model": "subscription",
        "interval": "month",
        "active": true,
        "createdAt": "2025-01-15T10:00:00Z"
      }
    ],
    "createdAt": "2025-01-15T10:00:00Z"
  },
  "error": null,
  "success": true
}

PATCH /v1/products/

Scopes: write
Idempotency-Key: required
{
  "name": "Pro Plan v2",
  "description": "Updated description.",
  "metadata": { "internal_id": "plan_pro_v2" }
}
  • name string optional
  • description string or null optional (null clears)
  • metadata object or null optional (null clears)
  • status enum optional: active | archived
Response 200: full updated product.

POST /v1/products//archive

Scopes: write
Idempotency-Key: required
Response 200
{
  "data": {
    "id": "prod_abc123",
    "status": "archived"
  },
  "error": null,
  "success": true
}
Error:
  • 409 active_subscription cannot archive a product with active subscriptions