Aller au contenu

POST /v1/products

POST
/v1/products
curl --request POST \
--url https://api.asap.cool/v1/products \
--header 'Content-Type: application/json' \
--data '{ "description": "example", "name": "example", "unit": "example", "unit_price_cents": 1, "vat_rate": "example" }'
Media type application/json

Body of POST /v1/products. org_id is never accepted here — it is resolved from the authenticated caller.

object
description

Optional description.

string | null
name

Name (required, trimmed, non-empty).

string | null
unit

Unit label.

string | null
unit_price_cents

Unit price excluding VAT, in integer centimes (>= 0).

integer | null format: int64
vat_rate

VAT rate as a percentage string in [0, 100] (e.g. "20.00").

string | null
Example generated
{
"description": "example",
"name": "example",
"unit": "example",
"unit_price_cents": 1,
"vat_rate": "example"
}

Product created.

Media type application/json

Public projection of a [Product].

object
created_at
required

RFC3339 creation timestamp.

string
description

Optional description.

string | null
id
required

Stable identifier.

string format: uuid
name
required

Name.

string
unit

Unit label (e.g. hour, day, piece).

string | null
unit_price_cents
required

Unit price excluding VAT, in integer centimes.

integer format: int64
updated_at
required

RFC3339 last-update timestamp.

string
vat_rate
required

VAT rate as a percentage string (e.g. "20.00").

string
Example generated
{
"created_at": "example",
"description": "example",
"id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"name": "example",
"unit": "example",
"unit_price_cents": 1,
"updated_at": "example",
"vat_rate": "example"
}

No active org.

Media type application/json

Generic error body returned by API handlers when they fail. code is a stable machine-readable token; message is human-friendly and meant for surfacing to end users.

object
code
required

Stable machine token (e.g. invalid_credentials).

string
field

Offending request field for validation errors, when known.

string | null
message
required

Human-readable message.

string
Example generated
{
"code": "example",
"field": "example",
"message": "example"
}

Missing invoice:write scope.

Media type application/json

Generic error body returned by API handlers when they fail. code is a stable machine-readable token; message is human-friendly and meant for surfacing to end users.

object
code
required

Stable machine token (e.g. invalid_credentials).

string
field

Offending request field for validation errors, when known.

string | null
message
required

Human-readable message.

string
Example generated
{
"code": "example",
"field": "example",
"message": "example"
}

Invalid product payload.

Media type application/json

Generic error body returned by API handlers when they fail. code is a stable machine-readable token; message is human-friendly and meant for surfacing to end users.

object
code
required

Stable machine token (e.g. invalid_credentials).

string
field

Offending request field for validation errors, when known.

string | null
message
required

Human-readable message.

string
Example generated
{
"code": "example",
"field": "example",
"message": "example"
}