Skip to main content

POST /api/v1/internal/projects/:projectUuid/apps/:projectAppUuid/products

Creates a new products resource.

This endpoint documentation is generated from the current Fastify route implementation and should be treated as the implementation-level contract for this version of the API.

Source route file: src/api/routes/internal/private/bearer/projects/apps/products/post.ts

Request Method

POST

Base URL

https://api.userdocks.local:5000

Endpoint

/api/v1/internal/projects/:projectUuid/apps/:projectAppUuid/products

Path Variables

VariableTypeRequiredDescription
projectUuidstringtruePath variable from route pattern.
projectAppUuidstringtruePath variable from route pattern.

Query Parameters

No query parameters.

HTTP Headers

VariableTypeRequiredDescription
AuthorizationstringtrueBearer token in the form Bearer <jwt>.
Content-TypestringtrueUse application/json for JSON request bodies.

Request Body

Schema reference: createProductSchema

{
"name": "Pro Plan",
"description": "Primary subscription product",
"shippable": false,
"packageDimensionHeight": 0,
"packageDimensionWidth": 0,
"packageDimensionLength": 0,
"packageDimensionWeight": 0,
"url": "https://example.com/products/pro-plan",
"prices": [
{
"unitAmount": 999,
"currency": "EUR",
"recurring": true,
"recurringInterval": "month",
"recurringIntervalCount": 1
}
],
"images": [
{
"url": "https://cdn.example.com/pro-plan.png"
}
]
}

Successful Response

Success status code(s): 201.

{
"kind": "products",
"totalItems": 1,
"itemsLength": 1,
"items": [
{
"uuid": "f119e8a1-aaaa-4a2d-9f1a-aaaaaaaaaaaa",
"name": "Pro Plan",
"description": "Subscription product",
"isActive": true,
"prices": [
{
"uuid": "price-1",
"currency": "usd",
"amount": 1999,
"interval": "month"
}
],
"images": [
{
"uuid": "img-1",
"url": "https://cdn.example.com/product.png"
}
],
"createdAt": "2026-01-01T00:00:00.000Z",
"updatedAt": "2026-01-01T00:00:00.000Z"
}
]
}

Error Responses

HTTP StatusExample Error
401{"errors":[{"validation":"error","code":"[E4010]","message":"Unauthorized Token"}]}
403{"errors":[{"validation":"error","code":"[E4030]","message":"App Is Disabled"}]}
400{"errors":[{"validation":"error","code":"[E4000]","message":"Bad Request / validation error"}]}
500{"errors":[{"validation":"error","code":"[E0000]","message":"Internal Server Error"}]}

Example

const url = `https://api.userdocks.local:5000/api/v1/internal/projects/projectUuid-value/apps/projectAppUuid-value/products`;

const response = await fetch(url, {
method: 'POST',
headers: {
Authorization: 'Bearer <jwt>',
'Content-Type': 'application/json',
},
body: '{"name":"Pro Plan","description":"Primary subscription product","shippable":false,"packageDimensionHeight":0,"packageDimensionWidth":0,"packageDimensionLength":0,"packageDimensionWeight":0,"url":"https://example.com/products/pro-plan","prices":[{"unitAmount":999,"currency":"EUR","recurring":true,"recurringInterval":"month","recurringIntervalCount":1}],"images":[{"url":"https://cdn.example.com/pro-plan.png"}]}',
});
const data = await response.json();
console.log(response.status, data);