# SkinsGateway developer guide

Source: https://skinsgateway.com/developers (HTML). Questions: support@skinsgateway.com.

## Getting started

1. Create an account on https://skinsgateway.com/dashboard and a project (one per website).
2. Copy the client id (`sg_…`), the live secret (`sk_live_…`) and the test secret (`sk_test_…`) from the project page; set a webhook URL and copy the signing secret (`whsec_…`).
3. Build everything with the test secret: nothing real moves, objects say `"livemode": false`, test webhooks carry `SkinsGateway-Test: 1`.
4. Switch to the live secret once your business is verified.

## Deposit flow

`POST /v1/deposits` → `created` (send the customer to `pay_url`, or load `embed_url` in an iframe) → the customer adds a trade link and picks items → `pending` (trade offer sent) → `in_hold` (Steam Trade Protection; not credited) → `success` (credited: `net_usd` = `amount_usd` − `fee_usd`). Also `fail`, `expired`, `hold_returned` (items returned during protection). You may release an `in_hold` deposit early with `POST /v1/deposits/{id}/approve` (`hold_approved`, credited; reversed if the trade is rolled back).

## Purchase flow

`POST /v1/market/purchases` holds `max_price` (plus the market fee) → `creating_trade` → `waiting_accept` → `accepted` (charged the real price, the rest released). Declined, timed out or rolled back purchases are refunded. `unknown` means the network did not answer in time; it settles within minutes.

## Following events

Three ways, all with the same event objects:

- **Webhooks**: we POST every event to your webhook URL, signed. Retried with back-off for about two days; `GET /v1/webhooks/failed` lists the ones that gave up.
- **Polling**: `GET /v1/events?after=<last evt id>` returns everything after your cursor, oldest first (`next_after`).
- **Live stream**: `GET /v1/events/stream` (Server-Sent Events). One connection stays open about 25 seconds, then closes; reconnect with `Last-Event-ID` and nothing is missed. In a browser-less client:

```js
// Node.js 18+ with the SDK
for await (const event of skinsgateway.events.stream({ after: lastId })) {
  if (event.type === 'deposit.success') creditOrder(event.data.order_id);
  lastId = event.id;
}
```

## Verifying webhooks

Header `SkinsGateway-Signature: t=<unix>,v1=<hex>`. Compute HMAC-SHA256 of `"<t>.<raw body>"` with your webhook signing secret, compare to `v1` in constant time, reject a `t` older than 5 minutes, answer any 2xx. The body carries `event_id` (the `evt_…` id in the event log) for de-duplication.

## SDKs

PHP 8.0+ (`SkinsGateway\Client`), Node.js 18+ (`skinsgateway`), Python 3.9+ (`skinsgateway`): downloads on https://skinsgateway.com/integrations and https://skinsgateway.com/developers#sdks. Each wraps every endpoint, verifies webhooks and reads the event log (`events.list()`, `events.stream()`).

# SkinsGateway API reference

> Version 1.3.0. Base URL `https://skinsgateway.com/api/v1`. OpenAPI: https://skinsgateway.com/api/openapi.json (YAML: https://skinsgateway.com/api/openapi.yaml), Postman: https://skinsgateway.com/api/postman.json. Interactive: https://skinsgateway.com/developers/reference.

REST over HTTPS, JSON in and out. Money in *_usd fields is USD; times are unix seconds (UTC).

Merchant operations: send X-Client-Id (sg_…) and X-Client-Secret (sk_live_… or sk_test_…). A test secret only sees test objects ("livemode": false) and nothing real ever moves.

Errors: HTTP 4xx/5xx with {"error":{"code","message","param"}}. Lists: {"object":"list","data":[…]} with page/limit/total/has_more (events: has_more/next_after).

Limits: 600 requests per minute per project and 1,200 per IP. 429 carries retry_after.

Webhooks: every event is POSTed to your webhook URL (signed) and kept in the event log (GET /events, live stream GET /events/stream).

## Errors

| Status | Meaning |
|---|---|
| 401 | Missing or wrong credentials. |
| 402 | Balance too low (insufficient_funds). |
| 403 | Not allowed (ip_not_allowed, project_disabled, test_mode_only, key revoked). |
| 404 | Unknown object, or one of another project / mode. |
| 409 | Conflict (duplicate_order_id, not_in_hold, invalid_transition). |
| 422 | A parameter is missing or invalid; see error.param. Payment network refusals also use 422 with their own code. |
| 429 | Too many requests; wait retry_after seconds. |
| 500 | Our fault; logged. Safe to retry with the same order_id / custom_id. |
| 502 | The payment network did not answer. Retry later. |
| 503 | The payment network is under maintenance. |

## General

Project, balance, currencies and the payment network status.

### Payment network status

`GET /v1/status`

Whether deposits can be taken right now. Check it before offering skins at checkout. Test mode: always available.

```bash
curl "https://skinsgateway.com/api/v1/status" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET"
```

Returns **200** `Status`. Errors: 401, 429, 500.

### Your project

`GET /v1/project`

The project the credentials belong to: status, defaults, fees and balance.

```bash
curl "https://skinsgateway.com/api/v1/project" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET"
```

Returns **200** `Project`. Errors: 401, 429, 500.

### Balance

`GET /v1/balance`

Available and reserved balance in USD (reserved = held for purchases and payouts in progress). Test mode: the test balance.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `currency` | query | string | no | Also return the balance converted to this display currency, e.g. eur. |

```bash
curl "https://skinsgateway.com/api/v1/balance" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET"
```

Returns **200** `Balance`. Errors: 401, 429, 500, 422.

### Balance history

`GET /v1/balance/history`

Every movement on the project balance, newest first.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `type` | query | string | no | Only entries of this type. One of: deposit, deposit_reversal, reserve, release, purchase, purchase_refund, adjustment, payout, referral, referral_reversal, topup. |
| `from` | query | integer | no | Created at or after (unix seconds). |
| `to` | query | integer | no | Created at or before (unix seconds). |
| `page` | query | integer | no | Page number, from 1. |
| `limit` | query | integer | no | Items per page, 1–100. |

```bash
curl "https://skinsgateway.com/api/v1/balance/history" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET"
```

Returns **200** `object`. Errors: 401, 429, 500, 422.

### Currencies

`GET /v1/currencies`

Currencies accepted in currency fields, with their rate per 1 USD. Balances are always kept in USD.

```bash
curl "https://skinsgateway.com/api/v1/currencies" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET"
```

Returns **200** `object`. Errors: 401, 429, 500.

### Update risk settings

`POST /v1/project/settings`

Automatic early release rules and the withdrawal approval switch. Every key is optional. An early-released credit stays reserved until the original Trade Protection end, then joins your available balance.

| Body field | Type | Required | Description |
|---|---|---|---|
| `early_release` | EarlyReleaseRules | yes |  |
| `withdrawals` | object | yes |  |

```bash
curl -X POST "https://skinsgateway.com/api/v1/project/settings" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET" \
  -H "Content-Type: application/json" \
  -d '{"early_release":{"auto":true,"min_trust":"high","max_amount_usd":100,"max_open_usd":1000},"withdrawals":{"require_approval":true}}'
```

Returns **200** `Project`. Errors: 401, 429, 500, 422.

## Deposits

Accept skins: hosted checkout, embedded checkout or your own item picker.

### Create a deposit (hosted checkout)

`POST /v1/deposits`

Creates a payment and returns a checkout link: send the customer to pay_url or load embed_url in an iframe. Idempotent by order_id: repeating the call with the same order_id and the same parameters returns the first deposit with HTTP 200 and the header Idempotent-Replayed: true (safe to retry after a timeout); the same order_id with other parameters returns 409 duplicate_order_id.

| Body field | Type | Required | Description |
|---|---|---|---|
| `order_id` | string | yes | Your reference, unique per project and mode (1–128 printable characters; no spaces, quotes or < >). |
| `currency` | string | no | Display and amount currency. Default: project setting. |
| `game` | string | no | Inventory opened first. Default: project setting. One of: cs2, dota2, rust. |
| `trade_url` | string | no | The customer's trade link, when you have it (skips that step). |
| `steam_id` | string | no | SteamID64, instead of trade_url. |
| `trade_token` | string | no | With steam_id. |
| `min_amount` | number | no | Lowest total the customer may send (in currency). |
| `max_amount` | number | no | Highest total the customer may send (in currency). |
| `success_url` | string | no | https URL after paying. Default: project setting. |
| `fail_url` | string | no | https URL after a failed or cancelled payment. |
| `result_url` | string | no | https URL for this deposit's webhooks. Default: project webhook URL. |
| `metadata` | object | no | Up to 20 flat key/value pairs, returned in every response and webhook. |
| `expires_in` | integer | no | Seconds until an unused link expires (300–604800). |
| `customer` | string | no | cus_… of one of your customers: the net goes to their wallet once the trade is final. Their trade link fills in when you send none. |
| `test_outcome` | string | no | Test mode only: ignored with a live secret. |

```bash
curl -X POST "https://skinsgateway.com/api/v1/deposits" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET" \
  -H "Content-Type: application/json" \
  -d '{"order_id":"order-10293","currency":"usd","min_amount":5,"success_url":"https://shop.example/orders/10293","metadata":{"user_id":"42"}}'
```

Returns **201** `Deposit`. Errors: 401, 429, 500, 409, 422.

### Create a direct deposit

`POST /v1/deposits/direct`

For your own item picker: load the inventory (GET /inventory), let the customer choose, send the asset ids. The trade offer is sent at once. A repeat with the same order_id and parameters returns the first deposit with HTTP 200 and Idempotent-Replayed: true (asset_ids are not compared); other parameters return 409 duplicate_order_id. While the deposit has no trade offer yet (the first attempt was refused), the same order_id starts a new attempt with the items of the new call. An item that is not in the inventory returns 422 items_not_accepted.

| Body field | Type | Required | Description |
|---|---|---|---|
| `order_id` | string | yes | Your unique reference. |
| `game` | string | yes | One of: cs2, dota2, rust. |
| `trade_url` | string | no | The customer's trade link (or steam_id + trade_token). |
| `steam_id` | string | no |  |
| `trade_token` | string | no |  |
| `asset_ids` | string[] | yes | Asset ids from GET /inventory. |
| `currency` | string | no |  |
| `result_url` | string | no |  |
| `metadata` | object | no |  |
| `customer` | string | no | cus_…: credit the net to this customer's wallet once the trade is final. |

```bash
curl -X POST "https://skinsgateway.com/api/v1/deposits/direct" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET" \
  -H "Content-Type: application/json" \
  -d '{"order_id":"order-10294","game":"cs2","trade_url":"https://steamcommunity.com/tradeoffer/new/?partner=39734272&token=AbCdEf12","asset_ids":["38291029381"]}'
```

Returns **201** `Deposit`. Errors: 401, 429, 500, 409, 422, 502, 503.

### List deposits

`GET /v1/deposits`

Deposits of this project and mode, newest first.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `status` | query | string | no | Only deposits in this status. One of: created, pending, in_hold, hold_approved, success, fail, hold_returned, expired. |
| `order_id` | query | string | no | Find a deposit by your order id. |
| `steam_id` | query | string | no | Deposits from one Steam account. |
| `from` | query | integer | no | Created at or after (unix seconds). |
| `to` | query | integer | no | Created at or before (unix seconds). |
| `page` | query | integer | no | Page number, from 1. |
| `limit` | query | integer | no | Items per page, 1–100. |

```bash
curl "https://skinsgateway.com/api/v1/deposits" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET"
```

Returns **200** `object`. Errors: 401, 429, 500, 422.

### Retrieve a deposit

`GET /v1/deposits/{id}`

One deposit by its dep_… id. Deposits still in flight are refreshed when you read them.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | yes | The deposit id. |

```bash
curl "https://skinsgateway.com/api/v1/deposits/dep_5f0c2a9e7b1d4c3a8e6f0b12" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET"
```

Returns **200** `Deposit`. Errors: 401, 429, 500, 404.

### Release a held deposit

`POST /v1/deposits/{id}/approve`

Credits an in_hold deposit now instead of after Steam Trade Protection. You take the risk: a reversed trade is taken back from your balance (deposit.hold_returned).

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | yes | The deposit id. |

```bash
curl -X POST "https://skinsgateway.com/api/v1/deposits/dep_5f0c2a9e7b1d4c3a8e6f0b12/approve" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET"
```

Returns **200** `Deposit`. Errors: 401, 429, 500, 404, 409.

### Customer inventory

`GET /v1/inventory`

A customer's inventory with prices, for direct deposits. price_with_bonus includes your project's bonus multiplier. Test mode: a simulated inventory of real items.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `trade_url` | query | string | no | The customer's Steam trade link (or steam_id + trade_token). |
| `steam_id` | query | string | no | SteamID64, with trade_token instead of trade_url. |
| `trade_token` | query | string | no | The 8-character token from the trade link. |
| `game` | query | string | no | Default: project setting. One of: cs2, dota2, rust. |
| `currency` | query | string | no | Default: project setting. |

```bash
curl "https://skinsgateway.com/api/v1/inventory" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET"
```

Returns **200** `Inventory`. Errors: 401, 429, 500, 422, 502, 503.

## Market

Buy skins with your balance and send them to your customers.

### Market price list

`GET /v1/market/items`

Every skin available to buy, grouped by name with the lowest price and the number of offers. Cached for 2 minutes.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `game` | query | string | no | Default cs2. One of: cs2, dota2, rust. |

```bash
curl "https://skinsgateway.com/api/v1/market/items" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET"
```

Returns **200** `MarketItemList`. Errors: 401, 429, 500, 422.

### Search the market

`GET /v1/market/search`

Individual items to buy, by (partial) name or with filters. Buy one with POST /market/purchases and its item_id.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `game` | query | string | yes | cs2, dota2 or rust. One of: cs2, dota2, rust. |
| `name` | query | string | no | At least 3 characters, words in any order. |
| `names[]` | query | string[] | no | Exact market hash names, up to 100. |
| `price_from` | query | number | no | USD (filter mode). |
| `price_to` | query | number | no | USD (filter mode). |
| `float_from` | query | number | no | CS2 float (filter mode). |
| `float_to` | query | number | no | CS2 float (filter mode). |
| `only_unlocked` | query | integer | no | 1 = only items without a trade lock (filter mode). One of: 0, 1. |
| `sort_by` | query | string | no | Filter mode sorting. One of: price, -price, float, -float. |
| `delivery_types[]` | query | integer[] | no | 1 instant, 2 slow (default both). |
| `limit` | query | integer | no | Name mode paging. |
| `offset` | query | integer | no | Name mode paging. |
| `cursor` | query | string | no | Filter mode paging: next_cursor of the previous page. |

```bash
curl "https://skinsgateway.com/api/v1/market/search?game=cs2" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET"
```

Returns **200** `MarketOfferList`. Errors: 401, 429, 500, 422, 502, 503.

### Buy a skin

`POST /v1/market/purchases`

Buys one skin with your project balance and sends it to a trade link. max_price (plus the market fee) is held, the real price charged, the rest released; failed deliveries are refunded. A repeated custom_id returns the existing purchase (200).

| Body field | Type | Required | Description |
|---|---|---|---|
| `custom_id` | string | yes | Your unique reference; repeating it returns the same purchase. |
| `trade_url` | string | yes | The customer's trade link. |
| `max_price` | number | yes | The most you pay, USD. |
| `item_id` | integer | no | An exact item from /market/search. |
| `name` | string | no | Instead of item_id: buy the cheapest offer with this market hash name. |
| `game` | string | no | With name. One of: cs2, dota2, rust. |
| `delivery_types` | integer[] | no | With name: [1] instant, [2] slow, [1,2] both. |
| `test_outcome` | string | no | Test mode only. One of: accepted, waiting_accept, failed, unknown. |

```bash
curl -X POST "https://skinsgateway.com/api/v1/market/purchases" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET" \
  -H "Content-Type: application/json" \
  -d '{"custom_id":"withdraw-5512","trade_url":"https://steamcommunity.com/tradeoffer/new/?partner=39734272&token=AbCdEf12","max_price":45,"item_id":482910233}'
```

Returns **201** `Purchase`. Errors: 401, 429, 500, 402, 422, 502, 503.

### Buy several skins

`POST /v1/market/purchases/batch`

Up to 50 items (by item_id) for one trade link in one call.

| Body field | Type | Required | Description |
|---|---|---|---|
| `trade_url` | string | yes |  |
| `items` | object[] | yes |  |

```bash
curl -X POST "https://skinsgateway.com/api/v1/market/purchases/batch" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET" \
  -H "Content-Type: application/json" \
  -d '{"trade_url":"https://steamcommunity.com/tradeoffer/new/?partner=39734272&token=AbCdEf12","items":[{"item_id":482910233,"max_price":45,"custom_id":"r-1"}]}'
```

Returns **201** `PurchaseBatch`. Errors: 401, 429, 500, 402, 422.

### Cancel purchases

`POST /v1/market/purchases/cancel`

Cancels purchases still waiting for a trade and at least 30 minutes old. Cancelled purchases are refunded.

| Body field | Type | Required | Description |
|---|---|---|---|
| `ids` | string[] | yes |  |
| `custom_ids` | string[] | yes |  |

```bash
curl -X POST "https://skinsgateway.com/api/v1/market/purchases/cancel" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET" \
  -H "Content-Type: application/json" \
  -d '{"custom_ids":["withdraw-5512"]}'
```

Returns **200** `PurchaseCancel`. Errors: 401, 429, 500, 422.

### List purchases

`GET /v1/market/purchases`

Purchases of this project and mode, newest first.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `status` | query | string | no | Only purchases in this status. One of: pending, unknown, creating_trade, waiting_accept, accepted, canceled, timeout, invalid_trade_token, user_not_tradable, trade_create_error, rollback_user, rollback_supplier, failed. |
| `custom_id` | query | string | no | Find a purchase by your custom id. |
| `from` | query | integer | no | Created at or after (unix seconds). |
| `to` | query | integer | no | Created at or before (unix seconds). |
| `page` | query | integer | no | Page number, from 1. |
| `limit` | query | integer | no | Items per page, 1–100. |

```bash
curl "https://skinsgateway.com/api/v1/market/purchases" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET"
```

Returns **200** `object`. Errors: 401, 429, 500, 422.

### Retrieve a purchase

`GET /v1/market/purchases/{id}`

One purchase by its pur_… id, refreshed while still in progress.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | yes | The purchase id. |

```bash
curl "https://skinsgateway.com/api/v1/market/purchases/pur_8a2b4c6d8e0f1a2b3c4d5e6f" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET"
```

Returns **200** `Purchase`. Errors: 401, 429, 500, 404.

## Payouts

Read the payouts requested in the dashboard.

### List payouts

`GET /v1/payouts`

Payouts from this project, newest first. Payouts are requested in the dashboard (two-factor code each time); the API is read-only.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `status` | query | string | no | pending, paid or rejected. One of: pending, paid, rejected. |
| `from` | query | integer | no | Created at or after (unix seconds). |
| `to` | query | integer | no | Created at or before (unix seconds). |
| `page` | query | integer | no | Page number, from 1. |
| `limit` | query | integer | no | Items per page, 1–100. |

```bash
curl "https://skinsgateway.com/api/v1/payouts" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET"
```

Returns **200** `object`. Errors: 401, 429, 500, 422.

### Retrieve a payout

`GET /v1/payouts/{id}`

One payout by its po_… id.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | yes | The payout id. |

```bash
curl "https://skinsgateway.com/api/v1/payouts/po_3c9d1e7a5b2f4a6c8e0d2b4f" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET"
```

Returns **200** `Payout`. Errors: 401, 429, 500, 404.

## Withdrawals

Let your users cash out in skins on a hosted page: you set the budget, they pick, we deliver.

### Create a skin withdrawal

`POST /v1/withdrawals`

Holds budget_usd on your balance and returns a link where your user picks skins up to that budget. With approval on, we call your webhook (withdrawal.approval_requested) before buying. Unspent budget comes back when it completes, fails, expires or is canceled.

| Body field | Type | Required | Description |
|---|---|---|---|
| `custom_id` | string | yes | Your unique reference; repeating it returns the same withdrawal. |
| `budget_usd` | number | yes | Most the user may spend; held on your balance now. |
| `user_reference` | string | no | Your user id, shown on the dashboard. |
| `game` | string | no | One of: cs2, dota2, rust. |
| `trade_url` | string | no | Optional; the user can enter it on the page. |
| `return_url` | string | no |  |
| `expires_in` | integer | no | Seconds the link stays open. |
| `metadata` | object | no |  |
| `customer` | string | no | cus_…: take the budget from this customer's wallet (402 insufficient_customer_funds); everything unspent goes back to it. |

```bash
curl -X POST "https://skinsgateway.com/api/v1/withdrawals" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET" \
  -H "Content-Type: application/json" \
  -d '{"custom_id":"cashout-5531","budget_usd":25,"user_reference":"user-42","game":"cs2","return_url":"https://shop.example/account"}'
```

Returns **201** `Withdrawal`. Errors: 401, 429, 500, 402, 409, 422.

### List withdrawals

`GET /v1/withdrawals`

Withdrawals of this project and mode, newest first.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `status` | query | string | no | Only this status. One of: created, processing, delivering, completed, failed, expired, canceled. |
| `custom_id` | query | string | no | Find by your reference or user reference. |
| `page` | query | integer | no | Page number, from 1. |
| `limit` | query | integer | no | Items per page, 1–100. |

```bash
curl "https://skinsgateway.com/api/v1/withdrawals" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET"
```

Returns **200** `object`. Errors: 401, 429, 500, 422.

### Retrieve a withdrawal

`GET /v1/withdrawals/{id}`

One withdrawal with every purchase it made.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | yes | The withdrawal id. |

```bash
curl "https://skinsgateway.com/api/v1/withdrawals/whd_1a2b3c4d5e6f7a8b9c0d1e2f" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET"
```

Returns **200** `Withdrawal`. Errors: 401, 429, 500, 404.

### Cancel a withdrawal

`POST /v1/withdrawals/{id}/cancel`

Before the user confirmed: closes the link and releases the budget.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | yes | The withdrawal id. |

```bash
curl -X POST "https://skinsgateway.com/api/v1/withdrawals/whd_1a2b3c4d5e6f7a8b9c0d1e2f/cancel" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET"
```

Returns **200** `Withdrawal`. Errors: 401, 429, 500, 404, 409.

## Customers

Wallets for your own users: a USD balance per user, filled with skins, spent on your site, cashed out in skins. Always held for them on your balance.

### Create a customer

`POST /v1/customers`

One of your users with a USD wallet. reference is your own user id, unique per project and mode: repeating it returns the existing customer (200). The trade link is used for their deposits and skin withdrawals.

| Body field | Type | Required | Description |
|---|---|---|---|
| `reference` | string | yes | Your own id for this user, unique per project and mode (1–128 printable characters; no spaces, quotes or < >). |
| `trade_url` | string | no | Their Steam trade link (used for deposits and skin withdrawals). |
| `steam_id` | string | no | SteamID64, when you have no trade link yet. |
| `metadata` | object | no | Up to 20 flat key/value pairs. |

```bash
curl -X POST "https://skinsgateway.com/api/v1/customers" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET" \
  -H "Content-Type: application/json" \
  -d '{"reference":"user-42","trade_url":"https://steamcommunity.com/tradeoffer/new/?partner=39734272&token=AbCdEf12","metadata":{"tier":"vip"}}'
```

Returns **201** `Customer`. Errors: 401, 429, 500, 403, 409, 422.

### List customers

`GET /v1/customers`

Customers of this project and mode, newest first.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `reference` | query | string | no | Find a customer by your reference (or their cus_… id). |
| `steam_id` | query | string | no | Customers with this SteamID64. |
| `status` | query | string | no | active or frozen. One of: active, frozen. |
| `page` | query | integer | no | Page number, from 1. |
| `limit` | query | integer | no | Items per page, 1–100. |

```bash
curl "https://skinsgateway.com/api/v1/customers" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET"
```

Returns **200** `object`. Errors: 401, 429, 500, 422.

### Retrieve a customer

`GET /v1/customers/{id}`

One customer with their wallet balance (balance_usd) and deposits still waiting for Steam Trade Protection to end (pending_usd, not spendable yet).

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | yes | The customer id. |

```bash
curl "https://skinsgateway.com/api/v1/customers/whd_1a2b3c4d5e6f7a8b9c0d1e2f" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET"
```

Returns **200** `Customer`. Errors: 401, 429, 500, 404.

### Update a customer

`POST /v1/customers/{id}`

Change the reference, the trade link (an empty trade_url removes it) or the metadata (replaced as a whole). Keys you leave out stay as they are.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | yes | The customer id. |

| Body field | Type | Required | Description |
|---|---|---|---|
| `reference` | string | yes |  |
| `trade_url` | string | yes | Empty string removes it. |
| `steam_id` | string | yes |  |
| `metadata` | object | yes | Replaces the metadata. |

```bash
curl -X POST "https://skinsgateway.com/api/v1/customers/whd_1a2b3c4d5e6f7a8b9c0d1e2f" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET" \
  -H "Content-Type: application/json" \
  -d '{"trade_url":"https://steamcommunity.com/tradeoffer/new/?partner=39734272&token=AbCdEf12"}'
```

Returns **200** `Customer`. Errors: 401, 429, 500, 404, 409, 422.

### Freeze a wallet

`POST /v1/customers/{id}/freeze`

Money still comes in (deposits, credits); debits and skin withdrawals are refused until you unfreeze it. A wallet that goes below zero (a returned deposit) is frozen automatically (customer.frozen).

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | yes | The customer id. |

```bash
curl -X POST "https://skinsgateway.com/api/v1/customers/whd_1a2b3c4d5e6f7a8b9c0d1e2f/freeze" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET"
```

Returns **200** `Customer`. Errors: 401, 429, 500, 404.

### Unfreeze a wallet

`POST /v1/customers/{id}/unfreeze`

Lifts your freeze. A wallet below zero stays frozen until a credit brings it back to zero or more (409 below_zero).

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | yes | The customer id. |

```bash
curl -X POST "https://skinsgateway.com/api/v1/customers/whd_1a2b3c4d5e6f7a8b9c0d1e2f/unfreeze" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET"
```

Returns **200** `Customer`. Errors: 401, 429, 500, 404, 409.

### Move money in or out of a wallet

`POST /v1/customers/{id}/transfers`

credit moves amount_usd from your available balance into the wallet (a win, a refund, a bonus; 402 insufficient_funds when your balance is short). debit moves it from the wallet to your available balance (a bet, a purchase on your site; 402 insufficient_customer_funds, 409 customer_frozen). reference is your unique id for the movement: repeating it returns the same transaction (200), never a second one.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | yes | The customer id. |

| Body field | Type | Required | Description |
|---|---|---|---|
| `direction` | string | yes | credit = your balance → the wallet, debit = the wallet → your balance. One of: credit, debit. |
| `amount_usd` | number | yes | 0.01 or more. |
| `reference` | string | yes | Your unique id for this movement (1–128 printable characters); repeating it is safe. |
| `description` | string | no | Shown in the wallet history (up to 255 characters). |
| `metadata` | object | no |  |

```bash
curl -X POST "https://skinsgateway.com/api/v1/customers/whd_1a2b3c4d5e6f7a8b9c0d1e2f/transfers" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET" \
  -H "Content-Type: application/json" \
  -d '{"direction":"debit","amount_usd":2.5,"reference":"bet-99812","description":"Case: Spring Collection"}'
```

Returns **201** `CustomerTransaction`. Errors: 401, 429, 500, 402, 404, 409, 422.

### Wallet history

`GET /v1/customers/{id}/transactions`

Every movement of one wallet, newest first: deposits, returned deposits, credits, debits, skin withdrawals and what came back from them.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | yes | The customer id. |
| `type` | query | string | no | Only this type. One of: deposit, deposit_reversal, credit, debit, withdrawal, withdrawal_return, adjustment. |
| `page` | query | integer | no | Page number, from 1. |
| `limit` | query | integer | no | Items per page, 1–100. |

```bash
curl "https://skinsgateway.com/api/v1/customers/whd_1a2b3c4d5e6f7a8b9c0d1e2f/transactions" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET"
```

Returns **200** `object`. Errors: 401, 429, 500, 404, 422.

### Open the hosted wallet page

`POST /v1/customers/{id}/session`

A short-lived link to a wallet page with your name on it (skinsgateway.com/pay/c/…, embeddable with ?embed=1): balance, deposit skins, withdraw skins, history. Create a new one each time your user opens their wallet.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | yes | The customer id. |

| Body field | Type | Required | Description |
|---|---|---|---|
| `return_url` | string | yes | https URL of the "Back" button. |
| `expires_in` | integer | yes | Seconds the link works (300–86400, default 3600). |
| `allow_deposit` | boolean | yes | Show "Deposit skins" (default true). |
| `allow_withdraw` | boolean | yes | Show "Withdraw skins" (default true). |

```bash
curl -X POST "https://skinsgateway.com/api/v1/customers/whd_1a2b3c4d5e6f7a8b9c0d1e2f/session" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET" \
  -H "Content-Type: application/json" \
  -d '{"return_url":"https://shop.example/account","expires_in":3600}'
```

Returns **201** `CustomerSession`. Errors: 401, 429, 500, 404, 422.

## Prize codes

Codes that turn into skins (tournaments, giveaways): the value is held on your balance when you create them.

### Create a batch of prize codes

`POST /v1/codes`

Creates quantity codes worth value_usd each (kind value), or for one skin (kind skin with game + name). The batch total is held on your balance at once; 402 insufficient_funds when it does not fit. The plain codes are in this answer only (store them now). Send an Idempotency-Key to make retries safe.

| Body field | Type | Required | Description |
|---|---|---|---|
| `quantity` | integer | yes | How many codes (1 to PRIZE_CODE_MAX_PER_BATCH). |
| `kind` | string | no | value = the winner picks any skin up to value_usd; skin = one named skin. One of: value, skin. |
| `value_usd` | number | no | Value per code in USD (kind value). |
| `game` | string | no | kind skin: the game. One of: cs2, dota2, rust. |
| `name` | string | no | kind skin: the market name of the skin. |
| `expires_in_days` | integer | no | How long the codes work (default and maximum in your project settings). |
| `label` | string | no | Your own name for the batch. |

```bash
curl -X POST "https://skinsgateway.com/api/v1/codes" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET" \
  -H "Content-Type: application/json" \
  -d '{"quantity":50,"value_usd":10,"expires_in_days":90,"label":"Spring cup 2027"}'
```

Returns **201** `PrizeCodeBatch`. Errors: 401, 429, 500, 402, 422.

### List batches

`GET /v1/codes`

Prize code batches of this project and mode, newest first, without the codes.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `page` | query | integer | no | Page number, from 1. |
| `limit` | query | integer | no | Items per page, 1–100. |

```bash
curl "https://skinsgateway.com/api/v1/codes" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET"
```

Returns **200** `object`. Errors: 401, 429, 500, 422.

### Retrieve a batch

`GET /v1/codes/{id}`

One batch with every code masked to its last 4 characters, its status and the purchase it became.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | yes | The batch id. |

```bash
curl "https://skinsgateway.com/api/v1/codes/whd_1a2b3c4d5e6f7a8b9c0d1e2f" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET"
```

Returns **200** `PrizeCodeBatch`. Errors: 401, 429, 500, 404.

### Void a batch

`POST /v1/codes/{id}/void`

Stops every unused code of the batch and releases what is still held back to your available balance. Codes already redeemed are not affected.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | yes | The batch id. |

```bash
curl -X POST "https://skinsgateway.com/api/v1/codes/whd_1a2b3c4d5e6f7a8b9c0d1e2f/void" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET"
```

Returns **200** `PrizeCodeBatch`. Errors: 401, 429, 500, 404, 409.

## Webhooks

Deliveries we sent to your webhook URL: list, failed ones, test, resend.

### List deliveries

`GET /v1/webhooks`

Webhook deliveries we sent to this project, newest first.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `status` | query | string | no | Only deliveries in this status. One of: pending, delivered, failed. |
| `page` | query | integer | no | Page number, from 1. |
| `limit` | query | integer | no | Items per page, 1–100. |

```bash
curl "https://skinsgateway.com/api/v1/webhooks" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET"
```

Returns **200** `object`. Errors: 401, 429, 500, 422.

### List failed deliveries

`GET /v1/webhooks/failed`

Deliveries that gave up after every retry (about two days), newest first. Fix your endpoint, then resend them.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `page` | query | integer | no | Page number, from 1. |
| `limit` | query | integer | no | Items per page, 1–100. |

```bash
curl "https://skinsgateway.com/api/v1/webhooks/failed" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET"
```

Returns **200** `object`. Errors: 401, 429, 500, 422.

### Send a test event

`POST /v1/webhooks/test`

Sends a signed test.ping to the project webhook URL and returns the delivery.

```bash
curl -X POST "https://skinsgateway.com/api/v1/webhooks/test" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET"
```

Returns **200** `WebhookDelivery`. Errors: 401, 429, 500, 422.

### Resend a delivery

`POST /v1/webhooks/{id}/resend`

Sends a delivery again right away.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | yes | The delivery id. |

```bash
curl -X POST "https://skinsgateway.com/api/v1/webhooks/whd_1a2b3c4d5e6f7a8b9c0d1e2f/resend" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET"
```

Returns **200** `WebhookDelivery`. Errors: 401, 429, 500, 404.

## Events

The event log behind the webhooks: catch up, poll or stream live (Server-Sent Events).

### List events

`GET /v1/events`

Every event of this project and mode, oldest first after a cursor: the same events and data the webhooks carry, also when no webhook URL is set. Kept 30 days. Pass the last id you processed as after (next_after of the previous page) to catch up.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `after` | query | string | no | Only events after this event id (exclusive). |
| `since` | query | integer | no | Only events created at or after this unix time. |
| `type` | query | string | no | Only these event types, comma separated (deposit.success,purchase.accepted). |
| `limit` | query | integer | no | Events per page, 1–100. |

```bash
curl "https://skinsgateway.com/api/v1/events" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET"
```

Returns **200** `EventList`. Errors: 401, 429, 500, 404, 422.

### Stream events live

`GET /v1/events/stream`

Server-Sent Events: every new event as it happens (id: evt_…, event: <type>, data: the event object). One connection stays open about 25 seconds with heartbeat comments, then closes; reconnect with the Last-Event-ID header (EventSource does this for you) and nothing is missed. Without a cursor the stream starts with the next new event.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `Last-Event-ID` | header | string | no | Resume after this event id (sent by EventSource on reconnect). |
| `after` | query | string | no | Resume after this event id (when you cannot set headers). |
| `type` | query | string | no | Only these event types, comma separated. |

```bash
curl -N "https://skinsgateway.com/api/v1/events/stream" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET" \
  -H "Accept: text/event-stream"
```

Returns **200** a `text/event-stream`. Errors: 401, 429, 500, 404, 422.

### Retrieve an event

`GET /v1/events/{id}`

One event by its evt_… id.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | yes | The event id. |

```bash
curl "https://skinsgateway.com/api/v1/events/evt_0b1c2d3e4f5a6b7c8d9e0f1a" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET"
```

Returns **200** `Event`. Errors: 401, 429, 500, 404.

## Test mode

Move test deposits and purchases to any outcome (test secret only).

### Simulate a deposit outcome

`POST /v1/test/deposits/{id}/simulate`

Test secret only (403 test_mode_only with a live secret). Moves a test deposit as if the customer and Steam acted: a created deposit first gets sample items sent, then the outcome runs through the live status code (same webhooks and events, test balance).

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | yes | The test deposit id. |

| Body field | Type | Required | Description |
|---|---|---|---|
| `outcome` | string | yes | One of: pending, in_hold, hold_approved, success, fail, hold_returned, expired. |

```bash
curl -X POST "https://skinsgateway.com/api/v1/test/deposits/dep_5f0c2a9e7b1d4c3a8e6f0b12/simulate" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET" \
  -H "Content-Type: application/json" \
  -d '{"outcome":"success"}'
```

Returns **200** `Deposit`. Errors: 401, 429, 500, 403, 404, 409, 422.

### Simulate a purchase outcome

`POST /v1/test/purchases/{id}/simulate`

Test secret only. Moves a test purchase to an outcome through the live settle / fail / refund code.

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | yes | The test purchase id. |

| Body field | Type | Required | Description |
|---|---|---|---|
| `outcome` | string | yes | One of: waiting_accept, accepted, canceled, timeout, trade_create_error, rollback_user, rollback_supplier, failed, reconcile. |

```bash
curl -X POST "https://skinsgateway.com/api/v1/test/purchases/pur_8a2b4c6d8e0f1a2b3c4d5e6f/simulate" \
  -H "X-Client-Id: $SKINSGATEWAY_CLIENT_ID" \
  -H "X-Client-Secret: $SKINSGATEWAY_CLIENT_SECRET" \
  -H "Content-Type: application/json" \
  -d '{"outcome":"accepted"}'
```

Returns **200** `Purchase`. Errors: 401, 429, 500, 403, 404, 409, 422.

## Webhook events

POSTed to your webhook URL as `{"id":"whd_…","event":"deposit.success","event_id":"evt_…","created":…,"livemode":true,"data":{…}}` with the headers `SkinsGateway-Event`, `SkinsGateway-Event-Id` (stable across retries and resends: dedupe on it), `SkinsGateway-Delivery`, `SkinsGateway-Timestamp`, `SkinsGateway-Signature: t=<unix>,v1=<hex HMAC-SHA256(webhook secret, "<t>.<raw body>")>` and, in test mode, `SkinsGateway-Test: 1`. Reject a `t` older than 5 minutes; answer any 2xx. The same events are in the event log (`GET /v1/events`, `GET /v1/events/stream`).

| Event | When |
|---|---|
| `deposit.pending` | A trade offer was sent to the customer. |
| `deposit.in_hold` | The customer accepted; Steam Trade Protection applies. Not credited yet. |
| `deposit.hold_approved` | A held deposit was released early and credited. |
| `deposit.success` | The deposit completed and was credited. |
| `deposit.fail` | The trade failed, was declined or timed out. |
| `deposit.hold_returned` | Items were returned during protection; any early credit was reversed. |
| `deposit.expired` | The checkout link expired unused. |
| `purchase.creating_trade` | A market purchase was made; the trade is being created. |
| `purchase.waiting_accept` | The trade offer was sent to the customer. |
| `purchase.accepted` | The skin was delivered. |
| `purchase.failed` | The purchase failed or was cancelled; the money was refunded. |
| `purchase.rolled_back` | The delivered skin was returned; the money was refunded. |
| `payout.pending` | A payout was requested; the amount moved from available to reserved. |
| `payout.paid` | The payout was sent. |
| `payout.rejected` | The payout was not sent; the amount is back on your available balance. |
| `balance.topup_credited` | A crypto top-up arrived and was added to your balance (data: the top-up). |
| `withdrawal.approval_requested` | Synchronous, only with approval on: answer 200 {"approve": true} within the timeout to buy the picked skins. |
| `withdrawal.completed` | At least one skin was delivered; unspent budget is back on your balance. |
| `withdrawal.failed` | Nothing was delivered; the whole budget is back. |
| `withdrawal.expired` | The link was never used; the budget is back. |
| `withdrawal.canceled` | You canceled it before the user confirmed; the budget is back. |
| `customer.balance_updated` | A customer wallet changed (data: the customer and the transaction): a final deposit, a returned deposit, a transfer, a skin withdrawal or what came back from it. |
| `customer.frozen` | A customer wallet was frozen (by you, by us, or automatically when a returned deposit took it below zero). |
| `test.ping` | Sent by POST /webhooks/test and the dashboard test button. |

## Objects

### Error

| Field | Type | Description |
|---|---|---|
| `error` | object |  |

### Status

| Field | Type | Description |
|---|---|---|
| `object` | string | One of: status. |
| `livemode` | boolean |  |
| `deposits_available` | boolean |  |
| `reason` | string | null | Why deposits are unavailable. One of: maintenance, no_capacity, null. |
| `checked_at` | integer |  |

### Project

| Field | Type | Description |
|---|---|---|
| `object` | string | One of: project. |
| `livemode` | boolean |  |
| `id` | string | prj_… |
| `name` | string |  |
| `status` | string |  |
| `live` | boolean | Can take live payments. |
| `website` | string | null |  |
| `default_currency` | string |  |
| `default_game` | string | One of: cs2, dota2, rust. |
| `bonus_multiplier` | number |  |
| `webhook_url` | string | null |  |
| `success_url` | string | null |  |
| `fail_url` | string | null |  |
| `fees` | object |  |
| `balance` | object |  |
| `early_release` | EarlyReleaseRules |  |
| `withdrawals` | object |  |

### EarlyReleaseRules

| Field | Type | Description |
|---|---|---|
| `auto` | boolean | Release held deposits automatically when they match the rules. |
| `min_trust` | string | One of: medium, high. |
| `max_amount_usd` | number | Largest single deposit released automatically. |
| `max_open_usd` | number | Most early-released value waiting for its hold end at once. |

### ProjectSettings

| Field | Type | Description |
|---|---|---|
| `early_release` | EarlyReleaseRules |  |
| `withdrawals` | object |  |

### CreateWithdrawal

| Field | Type | Description |
|---|---|---|
| `custom_id` | string | Your unique reference; repeating it returns the same withdrawal. |
| `budget_usd` | number | Most the user may spend; held on your balance now. |
| `user_reference` | string | Your user id, shown on the dashboard. |
| `game` | string | One of: cs2, dota2, rust. |
| `trade_url` | string | Optional; the user can enter it on the page. |
| `return_url` | string |  |
| `expires_in` | integer | Seconds the link stays open. |
| `metadata` | object |  |
| `customer` | string | cus_…: take the budget from this customer's wallet (402 insufficient_customer_funds); everything unspent goes back to it. |

### Withdrawal

| Field | Type | Description |
|---|---|---|
| `id` | string | wdr_… |
| `object` | string | One of: withdrawal. |
| `livemode` | boolean |  |
| `custom_id` | string |  |
| `user_reference` | string | null |  |
| `customer_id` | string | null | cus_… when paid from a customer wallet. |
| `status` | string | One of: created, processing, delivering, completed, failed, expired, canceled. |
| `url` | string | Send your user here. |
| `embed_url` | string | For an iframe or the pay button script. |
| `game` | string | null |  |
| `steam_id` | string | null |  |
| `budget_usd` | number |  |
| `spent_usd` | number |  |
| `held_usd` | number |  |
| `fail_reason` | string | null |  |
| `picked` | object[] |  |
| `items` | object[] |  |
| `return_url` | string | null |  |
| `metadata` | object |  |
| `expires_at` | integer | null |  |
| `created_at` | integer |  |
| `updated_at` | integer |  |
| `completed_at` | integer | null |  |

### CreateCustomer

| Field | Type | Description |
|---|---|---|
| `reference` | string | Your own id for this user, unique per project and mode (1–128 printable characters; no spaces, quotes or < >). |
| `trade_url` | string | Their Steam trade link (used for deposits and skin withdrawals). |
| `steam_id` | string | SteamID64, when you have no trade link yet. |
| `metadata` | object | Up to 20 flat key/value pairs. |

### UpdateCustomer

| Field | Type | Description |
|---|---|---|
| `reference` | string |  |
| `trade_url` | string | Empty string removes it. |
| `steam_id` | string |  |
| `metadata` | object | Replaces the metadata. |

### Customer

| Field | Type | Description |
|---|---|---|
| `id` | string | cus_… |
| `object` | string | One of: customer. |
| `livemode` | boolean |  |
| `reference` | string | Your id for this user. |
| `steam_id` | string | null |  |
| `trade_url` | string | null |  |
| `status` | string | One of: active, frozen. |
| `frozen_reason` | string | null | Why it is frozen. One of: negative, merchant, staff, null. |
| `balance_usd` | number | Wallet balance (can be below zero only after a returned deposit). |
| `pending_usd` | number | Deposits released early that join the wallet once Steam Trade Protection is over. |
| `metadata` | object |  |
| `created_at` | integer |  |
| `updated_at` | integer |  |

### CreateCustomerTransfer

| Field | Type | Description |
|---|---|---|
| `direction` | string | credit = your balance → the wallet, debit = the wallet → your balance. One of: credit, debit. |
| `amount_usd` | number | 0.01 or more. |
| `reference` | string | Your unique id for this movement (1–128 printable characters); repeating it is safe. |
| `description` | string | Shown in the wallet history (up to 255 characters). |
| `metadata` | object |  |

### CustomerTransaction

| Field | Type | Description |
|---|---|---|
| `id` | string | ctx_… |
| `object` | string | One of: customer_transaction. |
| `livemode` | boolean |  |
| `customer` | string | cus_… |
| `type` | string | One of: deposit, deposit_reversal, credit, debit, withdrawal, withdrawal_return, adjustment. |
| `amount_usd` | number | Change to the wallet (+ in, − out). |
| `balance_after_usd` | number |  |
| `reference` | string | null | Your transfer reference. |
| `description` | string |  |
| `deposit` | string | null | dep_… behind a deposit / returned deposit. |
| `withdrawal` | string | null | wdr_… behind a skin withdrawal. |
| `metadata` | object |  |
| `created_at` | integer |  |

### CreateCustomerSession

| Field | Type | Description |
|---|---|---|
| `return_url` | string | https URL of the "Back" button. |
| `expires_in` | integer | Seconds the link works (300–86400, default 3600). |
| `allow_deposit` | boolean | Show "Deposit skins" (default true). |
| `allow_withdraw` | boolean | Show "Withdraw skins" (default true). |

### CustomerSession

| Field | Type | Description |
|---|---|---|
| `id` | string | css_… |
| `object` | string | One of: customer_session. |
| `livemode` | boolean |  |
| `customer` | string | cus_… |
| `url` | string | Send your user here. |
| `embed_url` | string | For an iframe or the pay button script. |
| `return_url` | string | null |  |
| `allow` | object |  |
| `expires_at` | integer |  |
| `created_at` | integer |  |

### CustomerEvent

| Field | Type | Description |
|---|---|---|
| `customer` | Customer |  |
| `transaction` | any | The movement behind customer.balance_updated (null for customer.frozen). |

### Balance

| Field | Type | Description |
|---|---|---|
| `object` | string | One of: balance. |
| `livemode` | boolean |  |
| `currency` | string | One of: usd. |
| `available` | number |  |
| `reserved` | number |  |
| `total` | number |  |
| `converted` | object | null | The balance in the requested display currency. |

### BalanceEntry

| Field | Type | Description |
|---|---|---|
| `id` | integer |  |
| `object` | string | One of: balance_entry. |
| `livemode` | boolean |  |
| `type` | string | One of: deposit, deposit_reversal, reserve, release, purchase, purchase_refund, adjustment, payout, referral, referral_reversal, topup. |
| `amount_usd` | number | Signed change of the available balance. |
| `balance_after_usd` | number |  |
| `reserved_after_usd` | number |  |
| `reference` | object | null | The object behind the entry. |
| `description` | string | null |  |
| `created_at` | integer |  |

### Currency

| Field | Type | Description |
|---|---|---|
| `code` | string |  |
| `per_usd` | number | null |  |

### CreateDeposit

| Field | Type | Description |
|---|---|---|
| `order_id` | string | Your reference, unique per project and mode (1–128 printable characters; no spaces, quotes or < >). |
| `currency` | string | Display and amount currency. Default: project setting. |
| `game` | string | Inventory opened first. Default: project setting. One of: cs2, dota2, rust. |
| `trade_url` | string | The customer's trade link, when you have it (skips that step). |
| `steam_id` | string | SteamID64, instead of trade_url. |
| `trade_token` | string | With steam_id. |
| `min_amount` | number | Lowest total the customer may send (in currency). |
| `max_amount` | number | Highest total the customer may send (in currency). |
| `success_url` | string | https URL after paying. Default: project setting. |
| `fail_url` | string | https URL after a failed or cancelled payment. |
| `result_url` | string | https URL for this deposit's webhooks. Default: project webhook URL. |
| `metadata` | object | Up to 20 flat key/value pairs, returned in every response and webhook. |
| `expires_in` | integer | Seconds until an unused link expires (300–604800). |
| `customer` | string | cus_… of one of your customers: the net goes to their wallet once the trade is final. Their trade link fills in when you send none. |
| `test_outcome` | string | Test mode only: ignored with a live secret. |

### CreateDirectDeposit

| Field | Type | Description |
|---|---|---|
| `order_id` | string | Your unique reference. |
| `game` | string | One of: cs2, dota2, rust. |
| `trade_url` | string | The customer's trade link (or steam_id + trade_token). |
| `steam_id` | string |  |
| `trade_token` | string |  |
| `asset_ids` | string[] | Asset ids from GET /inventory. |
| `currency` | string |  |
| `result_url` | string |  |
| `metadata` | object |  |
| `customer` | string | cus_…: credit the net to this customer's wallet once the trade is final. |

### Deposit

| Field | Type | Description |
|---|---|---|
| `id` | string | dep_… |
| `object` | string | One of: deposit. |
| `livemode` | boolean |  |
| `order_id` | string |  |
| `status` | string | One of: created, pending, in_hold, hold_approved, success, fail, hold_returned, expired. |
| `flow` | string | One of: hosted, direct. |
| `pay_url` | string | null | Hosted checkout link (hosted flow). |
| `embed_url` | string | null | The checkout for an iframe. |
| `game` | string | null |  |
| `steam_id` | string | null |  |
| `currency` | string |  |
| `amount` | number | null | Value of the items in currency. |
| `amount_with_bonus` | number | null | What the customer is shown, with your bonus multiplier. |
| `bonus_multiplier` | number |  |
| `amount_usd` | number | null |  |
| `fee_usd` | number | null |  |
| `net_usd` | number | null | Credited to your balance. |
| `credited` | boolean |  |
| `min_amount` | number | null |  |
| `max_amount` | number | null |  |
| `required_amount` | number | null | The amount you asked for (min_amount, in currency), or null when there is no minimum. |
| `overpayment_usd` | number | null | Value received above required_amount, in USD. 0 when the customer sent exactly the minimum, null without a minimum or before the items are valued. |
| `fulfillment_allowed` | boolean | True only when the deposit is final (success) and credited. Never true while Steam Trade Protection can still return the items: deliver the order when this is true. |
| `trade_offer_id` | string | null |  |
| `trade_offer_url` | string | null |  |
| `trade_offer_expires_at` | integer | null | When the Steam trade offer runs out. |
| `sender_name` | string | null | Name of the Steam account the offer comes from. Show it so the customer can check the offer. |
| `sender_steam_id` | string | null |  |
| `fail_reason` | string | null |  |
| `hold_until` | integer | null | End of Steam Trade Protection (in_hold). |
| `user_risk` | object | null | Risk signals of the customer while in_hold. |
| `customer` | object | null | The paying Steam account and its trust level across SkinsGateway. |
| `customer_id` | string | null | cus_… when the deposit goes to one of your customers' wallets. |
| `early_release` | object | null | Set when the deposit was released before Trade Protection ended. The credit stays reserved until available_at. |
| `items` | object[] |  |
| `metadata` | object |  |
| `expires_at` | integer | null |  |
| `created_at` | integer |  |
| `updated_at` | integer |  |
| `completed_at` | integer | null |  |

### Inventory

| Field | Type | Description |
|---|---|---|
| `object` | string | One of: inventory. |
| `livemode` | boolean |  |
| `game` | string | One of: cs2, dota2, rust. |
| `currency` | string |  |
| `steam_id` | string |  |
| `items` | object[] |  |
| `total_available` | number |  |

### MarketItemList

| Field | Type | Description |
|---|---|---|
| `object` | string | One of: list. |
| `livemode` | boolean |  |
| `game` | string | One of: cs2, dota2, rust. |
| `updated_at` | integer |  |
| `data` | object[] |  |

### MarketOffer

| Field | Type | Description |
|---|---|---|
| `item_id` | integer | null |  |
| `name` | string |  |
| `price_usd` | number |  |
| `classid` | string | null |  |
| `delivery_type` | integer | null | 1 instant, 2 slow. |
| `float` | string | null |  |
| `paint_index` | integer | null |  |
| `paint_seed` | integer | null |  |
| `name_tag` | string | null |  |
| `stickers` | object[] |  |
| `inspect_link` | string | null |  |

### MarketOfferList

| Field | Type | Description |
|---|---|---|
| `object` | string | One of: list. |
| `livemode` | boolean |  |
| `data` | MarketOffer[] |  |
| `has_more` | boolean |  |
| `next_cursor` | string | null |  |

### CreatePurchase

| Field | Type | Description |
|---|---|---|
| `custom_id` | string | Your unique reference; repeating it returns the same purchase. |
| `trade_url` | string | The customer's trade link. |
| `max_price` | number | The most you pay, USD. |
| `item_id` | integer | An exact item from /market/search. |
| `name` | string | Instead of item_id: buy the cheapest offer with this market hash name. |
| `game` | string | With name. One of: cs2, dota2, rust. |
| `delivery_types` | integer[] | With name: [1] instant, [2] slow, [1,2] both. |
| `test_outcome` | string | Test mode only. One of: accepted, waiting_accept, failed, unknown. |

### CreatePurchaseBatch

| Field | Type | Description |
|---|---|---|
| `trade_url` | string |  |
| `items` | object[] |  |

### CancelPurchases

| Field | Type | Description |
|---|---|---|
| `ids` | string[] |  |
| `custom_ids` | string[] |  |

### Purchase

| Field | Type | Description |
|---|---|---|
| `id` | string | pur_… |
| `object` | string | One of: purchase. |
| `livemode` | boolean |  |
| `custom_id` | string |  |
| `status` | string | One of: pending, unknown, creating_trade, waiting_accept, accepted, canceled, timeout, invalid_trade_token, user_not_tradable, trade_create_error, rollback_user, rollback_supplier, failed. |
| `game` | string |  |
| `item_name` | string | null |  |
| `item_id` | integer | null |  |
| `classid` | string | null |  |
| `delivery_type` | integer | null |  |
| `steam_id` | string | null |  |
| `max_price_usd` | number |  |
| `price_usd` | number | null |  |
| `fee_usd` | number | null |  |
| `charged_usd` | number | null |  |
| `refunded_usd` | number |  |
| `trade_offer_id` | string | null |  |
| `error_reason` | string | null |  |
| `in_hold` | boolean |  |
| `in_hold_until` | integer | null |  |
| `created_at` | integer |  |
| `updated_at` | integer |  |
| `withdrawal` | string | null | wdr_… when the purchase belongs to a hosted skin withdrawal. |

### PurchaseBatch

| Field | Type | Description |
|---|---|---|
| `object` | string | One of: batch. |
| `livemode` | boolean |  |
| `purchases` | Purchase[] |  |
| `unavailable` | object[] |  |

### PurchaseCancel

| Field | Type | Description |
|---|---|---|
| `object` | string | One of: cancel. |
| `livemode` | boolean |  |
| `purchases` | Purchase[] |  |
| `unavailable` | object | Purchase id => reason it could not be cancelled. |

### Payout

| Field | Type | Description |
|---|---|---|
| `id` | string | po_… |
| `object` | string | One of: payout. |
| `status` | string | One of: pending, paid, rejected. |
| `project` | string | null |  |
| `method` | string | One of: crypto_link, crypto, sepa, ach, paypal, revolut, skrill, payoneer, blik, zen. |
| `destination` | object |  |
| `amount_usd` | number |  |
| `fee_usd` | number |  |
| `net_usd` | number |  |
| `reference` | string | null | Paid only: bank reference or transaction hash. |
| `claimable` | boolean | Crypto payout link only: true while the claim link is open. Claim it from the email or the dashboard. |
| `reason` | string | null | Rejected only. |
| `created_at` | integer |  |
| `completed_at` | integer | null |  |

### CreatePrizeCodes

| Field | Type | Description |
|---|---|---|
| `quantity` | integer | How many codes (1 to PRIZE_CODE_MAX_PER_BATCH). |
| `kind` | string | value = the winner picks any skin up to value_usd; skin = one named skin. One of: value, skin. |
| `value_usd` | number | Value per code in USD (kind value). |
| `game` | string | kind skin: the game. One of: cs2, dota2, rust. |
| `name` | string | kind skin: the market name of the skin. |
| `expires_in_days` | integer | How long the codes work (default and maximum in your project settings). |
| `label` | string | Your own name for the batch. |

### PrizeCodeBatch

| Field | Type | Description |
|---|---|---|
| `object` | string | One of: prize_code_batch. |
| `id` | string | pcb_… |
| `livemode` | boolean |  |
| `project` | string |  |
| `label` | string | null |  |
| `kind` | string | One of: value, skin. |
| `value_usd` | number |  |
| `skin` | object | null | kind skin only: game and name. |
| `quantity` | integer |  |
| `status` | string | active, voided or expired. |
| `counts` | object | Codes per status (unused, reserved, redeemed, expired, voided). |
| `held_usd` | number | Still held on your balance for unused codes. |
| `expires_at` | integer |  |
| `created` | integer |  |
| `codes` | any[] | Create answer: the plain codes (only time they are shown). Retrieve: each code masked with id, last4, status, purchase, redeemed_at. |

### Topup

| Field | Type | Description |
|---|---|---|
| `object` | string | One of: topup. |
| `id` | string | mtp_… |
| `livemode` | boolean |  |
| `project` | string |  |
| `status` | string | pending, credited or expired. |
| `amount_usd` | number |  |
| `paid_usd` | number | null |  |
| `credited_usd` | number | null |  |
| `coin` | string | null |  |
| `created` | integer |  |
| `paid_at` | integer | null |  |

### WebhookDelivery

| Field | Type | Description |
|---|---|---|
| `id` | string | whd_… |
| `object` | string | One of: webhook_delivery. |
| `livemode` | boolean |  |
| `event` | string | One of: deposit.pending, deposit.in_hold, deposit.hold_approved, deposit.success, deposit.fail, deposit.hold_returned, deposit.expired, purchase.creating_trade, purchase.waiting_accept, purchase.accepted, purchase.failed, purchase.rolled_back, payout.pending, payout.paid, payout.rejected, balance.topup_credited, withdrawal.approval_requested, withdrawal.completed, withdrawal.failed, withdrawal.expired, withdrawal.canceled, customer.balance_updated, customer.frozen, test.ping. |
| `url` | string |  |
| `status` | string | One of: pending, delivered, failed. |
| `attempts` | integer |  |
| `last_http_code` | integer | null |  |
| `last_error` | string | null |  |
| `next_attempt_at` | integer | null |  |
| `delivered_at` | integer | null |  |
| `created_at` | integer |  |

### Event

| Field | Type | Description |
|---|---|---|
| `id` | string | evt_… |
| `object` | string | One of: event. |
| `livemode` | boolean |  |
| `type` | string | One of: deposit.pending, deposit.in_hold, deposit.hold_approved, deposit.success, deposit.fail, deposit.hold_returned, deposit.expired, purchase.creating_trade, purchase.waiting_accept, purchase.accepted, purchase.failed, purchase.rolled_back, payout.pending, payout.paid, payout.rejected, balance.topup_credited, withdrawal.approval_requested, withdrawal.completed, withdrawal.failed, withdrawal.expired, withdrawal.canceled, customer.balance_updated, customer.frozen, test.ping. |
| `created` | integer |  |
| `data` | object | The object the event is about (deposit, purchase, payout), the same as the webhook's data. |
| `webhook` | object | null | The webhook delivery that carried it (none without a webhook URL). |

### EventList

| Field | Type | Description |
|---|---|---|
| `object` | string | One of: list. |
| `livemode` | boolean |  |
| `data` | Event[] |  |
| `has_more` | boolean |  |
| `next_after` | string | null | Pass as after to read on (the last id of this page). |

### WebhookEnvelope

| Field | Type | Description |
|---|---|---|
| `id` | string | The delivery id, whd_…. |
| `event` | string | One of: deposit.pending, deposit.in_hold, deposit.hold_approved, deposit.success, deposit.fail, deposit.hold_returned, deposit.expired, purchase.creating_trade, purchase.waiting_accept, purchase.accepted, purchase.failed, purchase.rolled_back, payout.pending, payout.paid, payout.rejected, balance.topup_credited, withdrawal.approval_requested, withdrawal.completed, withdrawal.failed, withdrawal.expired, withdrawal.canceled, customer.balance_updated, customer.frozen, test.ping. |
| `event_id` | string | The event id, evt_… (GET /events/{id}); use it to de-duplicate with the event log. |
| `created` | integer |  |
| `livemode` | boolean |  |
| `data` | object | Deposit, Purchase or Payout object (test.ping: {message, project}). |
