Products

envless.products.create()

Create a product in the workspace

def create(
    body: ProductCreate,
    *,
    timeout: float | None = None,
) -> 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 None 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

from envless import envless

product = envless.products.create({'name': 'Billing'})

print(product['id'], product['slug'])

Parameters

ParameterTypeRequiredDescription
body['name']strYesDisplay name for the product.
body['slug']strNoPreferred slug, slugified before it is validated for uniqueness.
timeoutfloatNoSeconds each attempt of this call may take, the response body included, before it raises EnvlessNetworkError with is_timeout set. Overrides the client's timeout for this call, and 0 turns the limit off.

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 TypeScript

envless.products.create()

The same method in @goenvless/sdk, with the same request, retries and errors.