# Create a trial offer

Creates a trial offer.

## Prerequisites

Before you can run the following code snippet, you need to call these APIs with the provided parameters to set up the prerequisite API object(s).

1. createPrice
POST /v1/prices {"currency":"usd","unit_amount":1000,"recurring":{"interval":"month"},"product_data":{"name":"Gold Plan"}}

## Request

```curl
curl https://api.stripe.com/v1/product_catalog/trial_offers \
  -u "<<YOUR_SECRET_KEY>>" \
  -d "duration[relative][iterations]=2" \
  -d "end_behavior[transition][price]={{PRICE_ID}}" \
  -d price={{PRICE_ID}}
```

### Response

```json
{
  "id": "to_1Hh5Xx2eZvKYlo2C8JaUOv4R",
  "object": "product_catalog.trial_offer",
  "livemode": false,
  "active": true,
  "duration": {
    "relative": {
      "iterations": 2
    },
    "type": "relative"
  },
  "end_behavior": {
    "transition": {
      "price": "price_1Hh5Xx2eZvKYlo2C8JaUOv3P"
    },
    "type": "transition"
  },
  "price": "price_1Hh5Xx2eZvKYlo2C8JaUOv2Q"
}
```

## Parameters

- [`duration`](https://docs.stripe.com/api/product-catalog/trial-offer/create.md?query=duration) (object, required)
  Duration of one service period of the trial.

- [`end_behavior`](https://docs.stripe.com/api/product-catalog/trial-offer/create.md?query=end_behavior) (object, required)
  Define behavior that occurs at the end of the trial.

- `price` (string, required)
  Price configuration during the trial period (amount, billing scheme, etc).

- `active` (boolean, optional)
  Whether the trial offer can be used for new subscriptions. Defaults to true.

- `nickname` (string, optional)
  A brief description of the trial offer, hidden from customers.

  The maximum length is 255 characters.

## Returns

Returns a trial offer object if the call succeeded.
