# Sandbox (Native /v1)

> Tickwire API reference, generated from the OpenAPI document the services export. Base URL: https://api.tickwire.io. Replace YOUR_API_KEY and YOUR_ACCOUNT_ID with your own values; use a sandbox key (twsk_…) to experiment.

Source: https://tickwire.io/docs/reference/sandbox/

### GET /v1/sandbox

**Sandbox Info**

Auth: `X-API-Key`

Public description of the sandbox; no key needed. `{sandbox: true,
server, keyPrefix, maxAccounts, signup, magicLogins: [{login, scenario}]}`.
`signup` says whether anonymous sign-up is open; each magic login, used as
the account login on the sandbox server, plays its scenario (see the
Sandbox guide).

Responses:

- `200` Successful Response

Common errors:

- `401` [`unauthorized`](https://tickwire.io/docs/errors/unauthorized/)
- `429` [`rate_limited`](https://tickwire.io/docs/errors/rate_limited/)
- `400, 422` [`validation_error`](https://tickwire.io/docs/errors/validation_error/)

curl:

```bash
curl -sS -X GET 'https://api.tickwire.io/v1/sandbox' \
  -H 'X-API-Key: YOUR_API_KEY'
```

Python:

```python
from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/v1/sandbox",
    )
    print(result)
```

TypeScript:

```typescript
import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/v1/sandbox");
console.log(result);
tw.close();
```

### POST /v1/sandbox/keys

**Create Key** · takes `Idempotency-Key`

Auth: `X-API-Key`

A `twsk_` key for the caller's sandbox (linked to a live tenant).
`Idempotency-Key` is honoured: a replay mints nothing and answers
`apiKey: null` with an `apiKeyNotice`.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `Idempotency-Key` | header | `string \| null` | no |  |

Request body: `KeyBody | null`

Responses:

- `201` Successful Response
- `422` Validation Error (`HTTPValidationError`)

Common errors:

- `401` [`unauthorized`](https://tickwire.io/docs/errors/unauthorized/)
- `429` [`rate_limited`](https://tickwire.io/docs/errors/rate_limited/)
- `400, 422` [`validation_error`](https://tickwire.io/docs/errors/validation_error/)
- `409` [`idempotency_conflict`](https://tickwire.io/docs/errors/idempotency_conflict/)

curl:

```bash
curl -sS -X POST 'https://api.tickwire.io/v1/sandbox/keys' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Idempotency-Key: my-request-1' \
  -H 'Content-Type: application/json' \
  -d '{"name":"sandbox"}'
```

Python:

```python
from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "POST",
        "/v1/sandbox/keys",
        json={"name": "sandbox"},
        idempotency_key="my-request-1",
        reason="why you are doing this",
    )
    print(result)
```

TypeScript:

```typescript
import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("POST", "/v1/sandbox/keys", {
  body: {"name":"sandbox"},
  idempotencyKey: "my-request-1",
  reason: "why you are doing this",
});
console.log(result);
tw.close();
```

### POST /v1/sandbox/signup

**Signup**

Auth: `X-API-Key`

Anonymous sandbox sign-up: a sandbox, a **restricted** `twsk_` key and
one deployed account (login `1000`, server `Tickwire-Sandbox`).

Body (optional): `{"platform": "mt5"|"mt4"}`. 201 `{sandbox: true,
restricted: true, tenantId, apiKey, account: {id, platform, server, login,
state, connectionStatus}}`. The key is shown once. A restricted key may
manage its accounts, trade, stream and read; anything else that changes
state (webhooks, pre-trade hooks, agent keys, more keys or tokens) answers
403 `sandbox_key_restricted`. Sign-ups are limited per client address (5 an
hour, 10 a day) and in total; over a limit, 429 `rate_limited` with
`Retry-After`. 403 `forbidden` when sign-up is turned off. Anonymous
sandboxes unused for 7 days are deleted.

Request body: `SandboxSignupBody | null`

Responses:

- `201` Successful Response
- `422` Validation Error (`HTTPValidationError`)

Common errors:

- `401` [`unauthorized`](https://tickwire.io/docs/errors/unauthorized/)
- `429` [`rate_limited`](https://tickwire.io/docs/errors/rate_limited/)
- `400, 422` [`validation_error`](https://tickwire.io/docs/errors/validation_error/)

curl:

```bash
curl -sS -X POST 'https://api.tickwire.io/v1/sandbox/signup' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"platform":"mt5"}'
```

Python:

```python
from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "POST",
        "/v1/sandbox/signup",
        json={"platform": "mt5"},
        idempotency_key="my-request-1",
        reason="why you are doing this",
    )
    print(result)
```

TypeScript:

```typescript
import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("POST", "/v1/sandbox/signup", {
  body: {"platform":"mt5"},
  idempotencyKey: "my-request-1",
  reason: "why you are doing this",
});
console.log(result);
tw.close();
```
