> Create or update a Plandalf product from your own system, matched by your lookup key so repeated calls never duplicate it.

Source: https://plandalf.com/docs/api/products

API and webhooks

# Products

Keep Plandalf's products in step with your own system. Each product has a `lookup_key` you choose, so you can send the same call whenever the product changes. Products made through the API are marked `source: external`. Add prices to them with [Prices](https://plandalf.com/docs/api/prices).

## Example

```bash
curl -X POST https://admin.plandalf.dev/api/v1/products \
  -H "Authorization: Bearer $PLANDALF_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"lookup_key": "gold-membership", "name": "Gold membership", "description": "Every class, every week", "status": "active"}'
```

Sending `gold-membership` again updates that product. Without a `lookup_key`, Plandalf makes a new product with a generated key; keep the key from the response to update it later.

## Endpoint

### Create or update a product

POST `/api/v1/products`

Upserts by `lookup_key`: sending a key that already exists updates that product, so it's safe to call whenever the product changes in your system. Without a `lookup_key` a new product is created with a generated key; store the returned `lookup_key` to update it later. Products created here are marked `source: external`.

#### Body

Field

Type

What it is

`name`

`string`

`description` optional

`string | null`

`lookup_key` optional

`string | null`

`status` optional

`"active" | "archived" | "draft"`

`bindings` optional

`array | null`

```bash
curl -X POST https://admin.plandalf.dev/api/v1/products \
  -H "Authorization: Bearer $PLANDALF_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"string","description":"string","lookup_key":"string","status":"active","bindings":null}'
```

#### Response

```json
{
  "id": "string",
  "uuid": "string",
  "lookup_key": "string",
  "name": "string",
  "description": "string",
  "status": "string",
  "source": "string",
  "created_at": "string"
}
```

#### Errors

Status

When

`401`

The API key or OAuth token is missing or invalid.

`422`

The request failed validation; `errors` lists the problems by field.

Something wrong or missing? Email [hello@plandalf.com](mailto:hello@plandalf.com).
