# Create a tier

> Creates a tier. `name`, `requests_per_minute`, `concurrency` and `free_credits` are required.

Source: https://docs.spicrawl.com/api-reference/partner/partner-tier-create

## POST /v1/partner/tiers

Operation ID: `partnerTierCreate`. API key scope: `partner`.

Creates a tier. `name`, `requests_per_minute`, `concurrency` and `free_credits` are required. The
partner's first tier becomes the default whatever `default` says. A value above the partner's ceiling
is `400`, and the message gives the bound. A name already used by another tier is `409`.

### Example

```bash
curl -X POST "https://api.spicrawl.com/v1/partner/tiers" \
  -H "Authorization: Bearer $SPICRAWL_API_KEY"
```

### Request body

`application/json`, required.

| Field | Type | Required | Description |
|---|---|---|---|
| `name` | string | yes | Trimmed before it is stored. |
| `requests_per_minute` | integer | yes |  |
| `concurrency` | integer | yes |  |
| `free_credits` | integer | yes |  |
| `wallet_cap` | integer | no |  |
| `default` | boolean | no | Makes this tier the default. Ignored for the partner's first tier, which is always the default. |

### Responses

#### 201

The tier was created.

`application/json`.

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Spicrawl's id for the tier. |
| `name` | string | yes | Unique among the partner's tiers, ignoring case. |
| `requests_per_minute` | integer | yes | Requests per minute a user may make to scrape, and cloud browser sessions a user may start. Cannot exceed the partner's ceiling (60 times its requests per second). |
| `concurrency` | integer | yes | Requests and browser sessions a user may run at once. Cannot exceed the partner's concurrency limit. |
| `free_credits` | integer | yes | Free credits per user per month, in whole credits. Cannot exceed the free credits Spicrawl grants the partner per workspace. |
| `wallet_cap` | integer | yes | Most credits per user per month the user may draw from the partner's balance. `null` means the tier sets no cap; a partner default then applies. |
| `default` | boolean | yes | True on the one tier new workspaces start on. |
| `workspaces` | integer | yes | Live workspaces on this tier. |
| `created_at` | string (date-time) | yes |  |
| `updated_at` | string (date-time) | yes |  |

#### 400

The request is invalid. Not retryable; fix the request using `code` and `diagnostics.hint`.

Headers: `X-Request-Id`.

`application/problem+json` (`Problem` schema).

#### 401

Missing, invalid, revoked or expired key. Not retryable with the same key.

Headers: `X-Request-Id`.

`application/problem+json` (`Problem` schema).

#### 403

The key lacks the scope this route requires (`ERR::AUTH::INSUFFICIENT_SCOPE`), or the action is not permitted.

Headers: `X-Request-Id`.

`application/problem+json` (`Problem` schema).

#### 409

Conflicts with the resource's current state, for example a session in use (`ERR::SESSION::BUSY`, retryable).

Headers: `X-Request-Id`.

`application/problem+json` (`Problem` schema).

#### 500

Internal error. Retryable when `retryable` is true.

Headers: `X-Request-Id`.

`application/problem+json` (`Problem` schema).

Full OpenAPI spec: https://docs.spicrawl.com/openapi.yaml
