create(body: ProductCreate, options?: RequestScope): Promise<ProductResource>Creates a product in the workspace the key is bound to. Only name is required: an omitted slug is derived from the name, and a supplied slug is slugified before validation, so My Product and my-product both land on my-product.
The response is built from the freshly inserted row, not from a read back. isPrivate is always false, updatedAt is always null and there is no locked field even when the new product went in beyond the plan cap. Call get when you need the settled shape, and update when you need the product to be private.
Example
const product = await envless.products.create({ name: 'Billing' })
console.log(product.id, product.slug)Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
body.name | string | Yes | Display name for the product. |
body.slug | string | No | Preferred slug, slugified before it is validated for uniqueness. |
options.signal | AbortSignal | No | Cancels the request. |
Returns
ProductResource for the new product, with isPrivate false and no locked field.
Worth knowing
- The plan allowance is checked before slug uniqueness, so a workspace at its cap reports the upgrade error even when the slug would also have collided.
- Icons cannot be set here or through
update.
Required scopes
products:write
Underlying endpoint
POST /products
Request and response schema, every error code, and a live playground.
In Python
envless.products.create()
The same method in envless-sdk, the Python SDK, with the same request, retries and errors.
In Ruby
Envless.products.create
The same method in envless-sdk, the Ruby gem, with the same request, retries and errors.
In PHP
$envless->products->create()
The same method in envless/sdk, the PHP SDK, with the same request, retries and errors.