# PostTerminalConnectionTokens

From **Stripe API**.

`POST /v1/terminal/connection_tokens`

<p>To connect to a reader the Stripe Terminal SDK needs to retrieve a short-lived connection token from Stripe, proxied through your server. On your backend, add an endpoint that creates and returns a connection token.</p>

## Request body

- Required: false
### `application/x-www-form-urlencoded`

- Type: `object`

```json
{"additionalProperties":false,"properties":{"expand":{"description":"Specifies which fields in the response should be expanded.","items":{"maxLength":5000,"type":"string"},"type":"array"},"location":{"description":"The id of the location that this connection token is scoped to. If specified the connection token will only be usable with readers assigned to that location, otherwise the connection token will be usable with all readers. Note that location scoping only applies to internet-connected readers. For more details, see [the docs on scoping connection tokens](https://stripe.com/docs/terminal/fleet/locations#connection-tokens).","maxLength":5000,"type":"string"}},"type":"object"}
```

## Security

### `basicAuth`

- Type: `http`
- Request header: `Authorization`
- Scheme: `basic`
Send credentials in the `Authorization` request header using the `Basic` scheme.

Basic HTTP authentication. Allowed headers-- Authorization: Basic <api_key> | Authorization: Basic <base64 hash of `api_key:`>

### `bearerAuth`

- Type: `http`
- Request header: `Authorization`
- Scheme: `bearer`
- Bearer format: `auth-scheme`
Send the token in the `Authorization` request header using the `Bearer` scheme.

Bearer HTTP authentication. Allowed headers-- Authorization: Bearer <api_key>

## Responses

### `200`

Successful response.

### `application/json`

- Type: `object`

A Connection Token is used by the Stripe Terminal SDK to connect to a reader.

Related guide: [Fleet Management](https://stripe.com/docs/terminal/fleet/locations).

```json
{"description":"A Connection Token is used by the Stripe Terminal SDK to connect to a reader.\n\nRelated guide: [Fleet Management](https://stripe.com/docs/terminal/fleet/locations).","properties":{"location":{"description":"The id of the location that this connection token is scoped to. Note that location scoping only applies to internet-connected readers. For more details, see [the docs on scoping connection tokens](https://stripe.com/docs/terminal/fleet/locations#connection-tokens).","maxLength":5000,"type":"string"},"object":{"description":"String representing the object's type. Objects of the same type share the same value.","enum":["terminal.connection_token"],"type":"string"},"secret":{"description":"Your application should pass this token to the Stripe Terminal SDK.","maxLength":5000,"type":"string"}},"required":["object","secret"],"title":"TerminalConnectionToken","type":"object","x-expandableFields":[],"x-resourceId":"terminal.connection_token"}
```

### `default`

Error response.

### `application/json`

- Type: `object`

An error response from the Stripe API

```json
{"description":"An error response from the Stripe API","properties":{"error":{"$ref":"#/components/schemas/api_errors"}},"required":["error"],"type":"object"}
```

## Request examples

### cURL

```shell
curl --request POST \
  --url https://api.stripe.com/v1/terminal/connection_tokens \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data '{
  "expand": [
    "string"
  ],
  "location": "string"
}'
```
