> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gettrxn.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Products

> Create and manage products for your account. Products represent the items or services that your customers can purchase using cryptocurrency payments.

This API allows you to create and manage products for your account. Products represent the items or services that your customers can purchase using cryptocurrency payments.

## The product object

<ResponseField name="id" type="string">
  Unique identifier with `prod_` prefix (e.g., `prod_abc123def456`).
</ResponseField>

<ResponseField name="name" type="string">
  The product's name. Leading and trailing whitespace is automatically trimmed.
</ResponseField>

<ResponseField name="created_at" type="string">
  When the product was created (ISO 8601).
</ResponseField>

<ResponseField name="updated_at" type="string">
  When the product was last updated (ISO 8601).
</ResponseField>

## List products

```
GET /v1/products
```

Retrieves a paginated list of all products in your account.

<ParamField query="page" type="integer" default="1">
  Page number for pagination. Results are returned 25 items per page.
</ParamField>

```bash theme={null}
curl https://api.gettrxn.com/v1/products \
  -H "Authorization: Bearer $TRXN_TOKEN"
```

```json Response theme={null}
{
  "products": [
    {
      "id": "prod_abc123def456",
      "name": "Premium Subscription",
      "created_at": "2024-01-01T12:00:00Z",
      "updated_at": "2024-01-01T12:00:00Z"
    },
    {
      "id": "prod_xyz789ghi012",
      "name": "Digital Course",
      "created_at": "2024-01-02T10:30:00Z",
      "updated_at": "2024-01-02T10:30:00Z"
    }
  ],
  "pagination": {
    "page": 1,
    "pages": 3,
    "count": 67
  }
}
```

## Get product

```
GET /v1/products/:id
```

Retrieves a specific product by ID.

<ParamField path="id" type="string" required>
  The product's ID (e.g., `prod_abc123def456`).
</ParamField>

```bash theme={null}
curl https://api.gettrxn.com/v1/products/prod_abc123def456 \
  -H "Authorization: Bearer $TRXN_TOKEN"
```

```json Response theme={null}
{
  "id": "prod_abc123def456",
  "name": "Premium Subscription",
  "created_at": "2024-01-01T12:00:00Z",
  "updated_at": "2024-01-01T12:00:00Z"
}
```

## Create product

```
POST /v1/products
```

Creates a new product in your account.

<ParamField body="name" type="string" required>
  The product's name. Whitespace is automatically trimmed. Cannot be blank.
</ParamField>

```bash theme={null}
curl -X POST https://api.gettrxn.com/v1/products \
  -H "Authorization: Bearer $TRXN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "New Digital Product"
  }'
```

```json Response theme={null}
{
  "id": "prod_new123product456",
  "name": "New Digital Product",
  "created_at": "2024-01-15T14:30:00Z",
  "updated_at": "2024-01-15T14:30:00Z"
}
```

### Validation errors

```json Name cannot be blank theme={null}
{
  "errors": {
    "name": ["can't be blank"]
  }
}
```

## Update product

```
PATCH /v1/products/:id
```

Updates an existing product.

<ParamField path="id" type="string" required>
  The product's ID (e.g., `prod_abc123def456`).
</ParamField>

<ParamField body="name" type="string">
  The product's name. Whitespace is automatically trimmed.
</ParamField>

```bash theme={null}
curl -X PATCH https://api.gettrxn.com/v1/products/prod_abc123def456 \
  -H "Authorization: Bearer $TRXN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Updated Product Name"
  }'
```

```json Response theme={null}
{
  "id": "prod_abc123def456",
  "name": "Updated Product Name",
  "created_at": "2024-01-01T12:00:00Z",
  "updated_at": "2024-01-15T16:45:00Z"
}
```

## Delete product

```
DELETE /v1/products/:id
```

Deletes a product from your account.

<Warning>
  This action is irreversible and will also delete the product's associated prices and other related data.
</Warning>

<ParamField path="id" type="string" required>
  The product's ID (e.g., `prod_abc123def456`).
</ParamField>

```bash theme={null}
curl -X DELETE https://api.gettrxn.com/v1/products/prod_abc123def456 \
  -H "Authorization: Bearer $TRXN_TOKEN"
```

Returns `204 No Content` on successful deletion.

## Product features

### Automatic name trimming

Product names automatically have leading and trailing whitespace removed during validation. This ensures consistent formatting and prevents issues with extra spaces.

### Associated prices

Products can have multiple associated prices for different pricing models (one-time payments, subscriptions, etc.). When a product is deleted, all associated prices are automatically removed.

### Name validation

Product names have the following validation rules:

* **Required**: Every product must have a name.
* **Trimmed**: Leading and trailing whitespace is automatically removed.
* **Flexible**: Names can contain special characters, unicode, and emojis.
* **No uniqueness constraint**: Multiple products can have the same name within an account.

## Pagination

By default, the API returns 25 products per page. Use the `page` query parameter to navigate through pages.

## Integration example

```bash theme={null}
# 1. Create a product
curl -X POST https://api.gettrxn.com/v1/products \
  -H "Authorization: Bearer $TRXN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "Premium Course"}'

# Response: {"id": "prod_abc123def456", "name": "Premium Course", ...}

# 2. Create a price for the product
curl -X POST https://api.gettrxn.com/v1/prices \
  -H "Authorization: Bearer $TRXN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "product_id": "prod_abc123def456",
    "amount": 9999,
    "currency": "USD",
    "recurring": false
  }'

# 3. Create a payment claim link using the price
curl -X POST https://api.gettrxn.com/v1/payment_claim_links \
  -H "Authorization: Bearer $TRXN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"price_id": "price_xyz789"}'
```

## Sandbox support

<Note>
  The API respects sandbox scoping. If your API token is associated with a sandbox, you can only access products created in that sandbox. Product names can be duplicated across different accounts and sandboxes.
</Note>
