## Fixtures

Use a JSON file to issue a series of API requests. This can be useful when generating sample data, executing specific flows, or testing API behavior. The structure of the JSON file outlines the set of requests to perform, known as _fixture requests_.

When you specify a request's `name`, the CLI stores the response so you can reference the output in subsequent requests. The `path` property specifies the Stripe URL route for the API resource used in the request (e.g. `/v1/customers`).

For example, to reference the response for the request named `json_path`:

*   Accessing attributes in responses: `${name:json_path}`
*   Accessing environment variables: `${.env:VARIABLE_NAME|}`

Fixture queries must start with `${` and end with `}` and can be included in fixture requests. `name` is the name of the request assigned as part of the fixture (`fixtures[].name`) and `json_path` is a dot-path to the specific variable requested. For example:

*   Use `${cus_jenny_rosen:id}` to access a top-level attribute.
*   Use `${cus_jenny_rosen:billing_details.address.country}` to access nested data.
*   Use `{cus_jenny_rosen:subscriptions.data.#.id}` to access data within a list at index #.
*   Use `${.env:PHONE}` to access environment variables (supports `.env` files). Environment variables can specify default values with the pipe character (`|`). For example:
    *   `${.env:EMAIL|jane@stripe.com}`
    *   `${.env:CUSTOMER|cus_1234}`

**Command:** `stripe fixtures`

### Arguments

*   `` Use the JSON file at the given path that includes fixture requests to run.

### Fields

*   `_meta` Metadata used by CLI during execution.
*   `template_version` Version of the template that is running (enables us to support potentially backwards-incompatible changes).
*   `fixtures` List of requests to execute.
*   `name` Name of the request, used to later reference the response
*   `expected_error_type` Indicates that this request is expected to return an error of the specified [error type](https://docs.stripe.com/error-codes). When set, the fixture continues executing subsequent requests even if this request returns an error