> This page is for Trading.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.immix.xyz/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.immix.xyz/_mcp/server.

# Update an API key

PUT /api-keys/{id}
Content-Type: application/json

Restates a key's grant and name (`api-keys:manage`), live at once — the key's next request is judged by the new grant. The grant's bounds are the issue's: capabilities you hold, or any holding `users:manage` (else 403 `CAPABILITY_DENIED`), none a key never holds (422 `INVALID_FIELD`); a `DELETED` key refuses 409 `ILLEGAL_TRANSITION`. A key restates none.

Reference: https://docs.immix.xyz/trading/api-reference/rest-api/api-keys/update

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `id` (integer, required) — The record's id — a positive 32-bit integer the platform minted.

### Query parameters

- `minGlobalSequence` (string, optional) — A position you hold — an `X-Immix-Global-Sequence` you read, or a 202's `commandGlobalSequence`: this member answers only once it has folded the platform's stream through it, waiting up to its deadline, then 503 `PROJECTION_BEHIND` with `Retry-After`. Within that stream a read is never older than what you have seen; drop your positions after an announced stream cut. A retry stating its 202's position attaches to or replays that operation while the journal holds its key, never publishing twice. Stated once: one to nineteen digits, at most 9223372036854775807; else 400 `MALFORMED_REQUEST`.

### Headers

- `Idempotency-Key` (string, required) — Required on every write: a URL-safe string of 1 to 64 characters from `[A-Za-z0-9._~-]` (a UUID fits), scoped to you. It names one operation on one record, ever: a retry replays the stored outcome (`Idempotent-Replay: true`) or attaches to the live one, and reuse on another record refuses 409 `IDEMPOTENCY_KEY_REUSED`. Missing or malformed, 400.
- `If-Match` (string, required) — Required on every entity write: the `ETag` the read minted, quoted or bare — the version this write was computed against — or `*` to write unconditionally on purpose, except on a notification endpoint's approval, which refuses `*` 400 `INVALID_IF_MATCH`. Absent is 428 `PRECONDITION_REQUIRED`; a weak validator 400 `INVALID_IF_MATCH`; a stale value 412 `VERSION_CONFLICT` (`CONFIG_SEQ_CONFLICT` on an algo's config write) with `currentVersion` and a fresh `ETag`: re-read, reapply, retry. A `*` write overwrites every field from your copy, a colleague's amend since your read included.
- `X-Request-Id` (string, optional) — Your own id for the request: 8 to 128 of `[A-Za-z0-9._-]`. It becomes the request's id and is echoed on the response. A value off that grammar is replaced with a fresh id, never refused.

### Body (application/json)

This endpoint expects an object.

- `name` (string, required) — The key's name, unique among the organisation's live keys. At most 128 bytes; longer refuses INVALID_FIELD.
- `apiKeyId` (integer, optional)
- `expectedVersion` (string, optional, nullable) — int64 as a decimal JSON string
- `capabilities` (list of enum, optional) — The bits the key holds from here — the same rule as the issue's. a set (SBE bit-set) served as the array of its scope strings, each a `Capability`, in declared order; empty = none set, never null; as input a repeated name refuses 400
  - Allowed values: `users:manage`, `accounts:propose`, `accounts:approve`, `account-addresses:propose`, `account-addresses:approve`, `portfolios:manage`, `asset-policies:propose`, `asset-policies:approve`, `chain-policies:propose`, `chain-policies:approve`, `trading-policies:propose`, `trading-policies:approve`, `orders:trade`, `algos:manage`, `users:read`, `venue-keys:read`, `accounts:read`, `account-addresses:read`, `portfolios:read`, `asset-policies:read`, `chain-policies:read`, `trading-policies:read`, `orders:read`, `algos:read`, `org:manage`, `risk:read`, `risk:propose`, `risk:approve`, `api-keys:manage`, `transfers:read`, `transfers:propose`, `transfers:approve`, `notifications:manage`
- `preset` (enum, optional) — A capability preset the edge expands to its scope strings and never forwards — the row records the capabilities, never a preset. A key holds no `users:manage`, no `api-keys:manage`, no `notifications:manage`, no `risk:propose`, no `transfers:propose` and no `approve` capability: a preset or set naming one is refused 422 `INVALID_FIELD`. Preset or capabilities names the set, stored with the reads its verbs imply: the two must name one set once those reads are added, else 400.
  - Allowed values: `INITIATOR`, `APPROVER`, `ADMIN`, `TRADER`, `TREASURY`

## Response

### 200

The API key as the platform now holds it after the write — the same row the read serves, with the answering change's position, the row's `ETag` and, on a replayed key, `Idempotent-Replay`.

- `apiKeyId` (integer, required) — Sticky entity key.
- `capabilities` (list of enum, required) — What the key may do — the bits a member could hold, less what a key is never granted: an approve bit, users:manage, api-keys:manage, risk:propose and transfers:propose (the risk writes name a member, and a transfer's maker is one) and the platform's bit. A key granted transfers:propose before the grant was refused keeps it here and can use it nowhere. Stored with the reads its verbs imply. a set (SBE bit-set) served as the array of its scope strings, each a `Capability`, in declared order; empty = none set, never null; as input a repeated name refuses 400
  - Allowed values: `users:manage`, `accounts:propose`, `accounts:approve`, `account-addresses:propose`, `account-addresses:approve`, `portfolios:manage`, `asset-policies:propose`, `asset-policies:approve`, `chain-policies:propose`, `chain-policies:approve`, `trading-policies:propose`, `trading-policies:approve`, `orders:trade`, `algos:manage`, `users:read`, `venue-keys:read`, `accounts:read`, `account-addresses:read`, `portfolios:read`, `asset-policies:read`, `chain-policies:read`, `trading-policies:read`, `orders:read`, `algos:read`, `org:manage`, `risk:read`, `risk:propose`, `risk:approve`, `api-keys:manage`, `transfers:read`, `transfers:propose`, `transfers:approve`, `notifications:manage`
- `createdAtNs` (string, required) — Platform time the key was issued, epoch nanoseconds. int64 as a decimal JSON string
- `createdBy` (Actor, required) — Who issued the key — the api-keys:manage holder, a member. an actor: an object \{kind, id}
- `globalSequence` (string, required) — The position as a decimal string — the last change this member had applied, orders, balance readings and algo instances included.
- `lastActiveAtNs` (string, required, nullable) — When the principal was last seen acting — its last admitted request on this API (one a read replica serves is not recorded), or its open trading socket — epoch nanoseconds at a five-minute grain: a request inside five minutes of the mark need not move it, so read it as active within five minutes of this time. `null` while no mark is recorded: the principal has not acted since marks were first kept (0.71.0), or ever. A mark beside the row, not a field of it: it moves no `version` and no `ETag`.
- `name` (string, required) — The key's name — unique among the organisation's live keys. At most 128 bytes; longer refuses INVALID_FIELD.
- `orgId` (integer, required) — The organisation the key acts in — stamped by the owner from the issuer's organisation, never client-supplied.
- `status` (enum, required) — UNKNOWN is the unset sentinel: outputs only — as input the field is required, and explicit UNKNOWN refuses 400. A consumer READING this field treats an unknown name as UNKNOWN, never as an error; as input an unknown name refuses 400 — the parse is strict
  - Allowed values: `UNKNOWN`, `ACTIVE`, `DISABLED`, `DELETED`
- `version` (string, required) — Monotonic per entity. int64 as a decimal JSON string
- `rotatedBy` (Actor, optional, nullable) — Who last rotated the key — the api-keys:manage holder its current secret was answered to, a member; null until the first rotation. The member behind what the key proposes from here on: a proposal it makes pins them as its record's keyHolder, and neither they nor the key's issuer may approve it (SELF\_APPROVAL). an actor: an object \{kind, id}; null where none is stated

## Errors

### 400 Update API Keys Request Bad Request Error

Refused at the door — nothing reached the platform and the key was not journaled: a missing or malformed `Idempotency-Key`, a malformed `If-Match` (an absent one is 428 `PRECONDITION_REQUIRED`), malformed JSON, a body `actor` (or `userId`, its spelling before the actor), a body restating the path or `If-Match` differently, a money string off its `pattern` (an exponent, a plus sign, a bare point, surrounding whitespace) or past its `maxLength`, or one no value here can state (over 18 fractional digits, or past a 64-bit integer at its own scale), or any other value outside the schema.

- `error` (ErrorBody, required) — What a refusal states. Since `0.12.0` every refusal carries all four members; a member below it sends `code`, sometimes `message`, and neither of the others.
- `currentVersion` (string, optional) — On 412 `VERSION_CONFLICT`, or `CONFIG_SEQ_CONFLICT` on an algo instance's config write: the row's current version (the `ETag` carries the same token) — re-read, reapply, retry.

### 401 Update API Keys Request Unauthorized Error

No bearer token, or one that does not verify.

- `error` (ErrorBody, required) — What a refusal states. Since `0.12.0` every refusal carries all four members; a member below it sends `code`, sometimes `message`, and neither of the others.
- `currentVersion` (string, optional) — On 412 `VERSION_CONFLICT`, or `CONFIG_SEQ_CONFLICT` on an algo instance's config write: the row's current version (the `ETag` carries the same token) — re-read, reapply, retry.

### 403 Update API Keys Request Forbidden Error

`CAPABILITY_DENIED`: a read your capabilities do not cover, or a staging route without its propose bit (`accounts:propose`). `NOT_REGISTERED`: no row or open invitation at your verified address, an unknown organisation, or an unclaimed row (an administrator admits it). `EMAIL_UNVERIFIED`: verify, then sign in again. `INVITATION_EXPIRED`: an administrator re-invites. `FORBIDDEN_PRINCIPAL`: no `org_id`, a non-ASCII ref, a disabled user, a binding with no user. `ORG_NOT_ACTIVE`: disabled, pending or deleted. Owners' 403s carry the position header and `Idempotent-Replay`.

- `error` (ErrorBody, required) — What a refusal states. Since `0.12.0` every refusal carries all four members; a member below it sends `code`, sometimes `message`, and neither of the others.
- `currentVersion` (string, optional) — On 412 `VERSION_CONFLICT`, or `CONFIG_SEQ_CONFLICT` on an algo instance's config write: the row's current version (the `ETag` carries the same token) — re-read, reapply, retry.

### 404 Update API Keys Request Not Found Error

No such row in your organisation — another organisation's row is indistinguishable from an absent one. The position header says as of when.

- `error` (ErrorBody, required) — What a refusal states. Since `0.12.0` every refusal carries all four members; a member below it sends `code`, sometimes `message`, and neither of the others.
- `currentVersion` (string, optional) — On 412 `VERSION_CONFLICT`, or `CONFIG_SEQ_CONFLICT` on an algo instance's config write: the row's current version (the `ETag` carries the same token) — re-read, reapply, retry.

### 409 Update API Keys Request Conflict Error

The record owner's refusal, 409 for state or uniqueness and 422 for a field or reference, is a fact on the stream: it carries the position header and a retried key replays it. Door refusals ride the same statuses without the header, never journaled, so a retry takes fresh: 409 `IDEMPOTENCY_KEY_REUSED`; 422 `INSTRUMENT_NOT_LIVE` or `ACCOUNT_NOT_ACTIVE` on `POST /orders`, `REFERENCE_UNKNOWN_INSTRUMENT`, `REFERENCE_INSTRUMENT_NOT_LIVE` or `REFERENCE_UNKNOWN_ACCOUNT` in an algo document (every one answers a held key as its retry).

- `error` (ErrorBody, required) — What a refusal states. Since `0.12.0` every refusal carries all four members; a member below it sends `code`, sometimes `message`, and neither of the others.
- `currentVersion` (string, optional) — On 412 `VERSION_CONFLICT`, or `CONFIG_SEQ_CONFLICT` on an algo instance's config write: the row's current version (the `ETag` carries the same token) — re-read, reapply, retry.

### 412 Update API Keys Request Precondition Failed Error

`If-Match` is stale (`VERSION_CONFLICT`): the envelope carries `currentVersion` and the `ETag` header the current row — re-read, reapply, retry. A retried key replays it with `Idempotent-Replay`.

- `error` (ErrorBody, required) — What a refusal states. Since `0.12.0` every refusal carries all four members; a member below it sends `code`, sometimes `message`, and neither of the others.
- `currentVersion` (string, optional) — On 412 `VERSION_CONFLICT`, or `CONFIG_SEQ_CONFLICT` on an algo instance's config write: the row's current version (the `ETag` carries the same token) — re-read, reapply, retry.

### 413 Update API Keys Request Content Too Large Error

The request is too large: a body declared past 1 MB (`PAYLOAD_TOO_LARGE`), or a command past the platform's own bound (`TOO_LARGE`, not expected for any route here). Nothing was submitted; a retry takes fresh.

- `error` (ErrorBody, required) — What a refusal states. Since `0.12.0` every refusal carries all four members; a member below it sends `code`, sometimes `message`, and neither of the others.
- `currentVersion` (string, optional) — On 412 `VERSION_CONFLICT`, or `CONFIG_SEQ_CONFLICT` on an algo instance's config write: the row's current version (the `ETag` carries the same token) — re-read, reapply, retry.

### 422 Update API Keys Request Unprocessable Entity Error

The record owner's refusal, 409 for state or uniqueness and 422 for a field or reference, is a fact on the stream: it carries the position header and a retried key replays it. Door refusals ride the same statuses without the header, never journaled, so a retry takes fresh: 409 `IDEMPOTENCY_KEY_REUSED`; 422 `INSTRUMENT_NOT_LIVE` or `ACCOUNT_NOT_ACTIVE` on `POST /orders`, `REFERENCE_UNKNOWN_INSTRUMENT`, `REFERENCE_INSTRUMENT_NOT_LIVE` or `REFERENCE_UNKNOWN_ACCOUNT` in an algo document (every one answers a held key as its retry).

- `error` (ErrorBody, required) — What a refusal states. Since `0.12.0` every refusal carries all four members; a member below it sends `code`, sometimes `message`, and neither of the others.
- `currentVersion` (string, optional) — On 412 `VERSION_CONFLICT`, or `CONFIG_SEQ_CONFLICT` on an algo instance's config write: the row's current version (the `ETag` carries the same token) — re-read, reapply, retry.

### 428 Update API Keys Request Precondition Error

The entity write carries no `If-Match` (`PRECONDITION_REQUIRED`): refused at the door — nothing reached the platform and the key was not journaled. Send the `ETag` the row was read at, or `*` to write unconditionally on purpose, and send the request again under the same key.

- `error` (ErrorBody, required) — What a refusal states. Since `0.12.0` every refusal carries all four members; a member below it sends `code`, sometimes `message`, and neither of the others.
- `currentVersion` (string, optional) — On 412 `VERSION_CONFLICT`, or `CONFIG_SEQ_CONFLICT` on an algo instance's config write: the row's current version (the `ETag` carries the same token) — re-read, reapply, retry.

### 429 Update API Keys Request Too Many Requests Error

Shed at once: `INBOX_FULL` or `IN_FLIGHT_FULL` (this member's bounds; nothing queued, the key not journaled), the intake's or the ticket route's `RATE_LIMITED`, or the orders owner's `RATE_CEILING` (the organisation's per-minute ceiling — a refusal on the stream, replayed like any, so its `retryable` is `false` and the order goes again under a fresh key). `Retry-After` says when.

- `error` (ErrorBody, required) — What a refusal states. Since `0.12.0` every refusal carries all four members; a member below it sends `code`, sometimes `message`, and neither of the others.
- `currentVersion` (string, optional) — On 412 `VERSION_CONFLICT`, or `CONFIG_SEQ_CONFLICT` on an algo instance's config write: the row's current version (the `ETag` carries the same token) — re-read, reapply, retry.

### 500 Update API Keys Request Internal Server Error

The gateway failed to serve (`INTERRUPTED`, `INTERNAL_ERROR`, `PROJECTION_MISS`); the operation record, if one exists, is still readable.

- `error` (ErrorBody, required) — What a refusal states. Since `0.12.0` every refusal carries all four members; a member below it sends `code`, sometimes `message`, and neither of the others.
- `currentVersion` (string, optional) — On 412 `VERSION_CONFLICT`, or `CONFIG_SEQ_CONFLICT` on an algo instance's config write: the row's current version (the `ETag` carries the same token) — re-read, reapply, retry.

### 503 Update API Keys Request Service Unavailable Error

This member cannot carry the write now: `NOT_PRIMED` (still catching up), `NOT_SERVING` (a read-only or not-ready member, or one that could not look the request's key up within the deadline), `OWNER_ABSENT` (the record owner has no active member), `INTAKE_UNAVAILABLE` (no credential store here), `REGISTRATION_PENDING` (your invitation's claim is in flight — retry after `Retry-After`), `PROJECTION_BEHIND` (behind your `If-Match` version or `minGlobalSequence` by the deadline), or the platform's own outcome for a command lost in transit. Nothing was journaled; retry against a serving member.

- `error` (ErrorBody, required) — What a refusal states. Since `0.12.0` every refusal carries all four members; a member below it sends `code`, sometimes `message`, and neither of the others.
- `currentVersion` (string, optional) — On 412 `VERSION_CONFLICT`, or `CONFIG_SEQ_CONFLICT` on an algo instance's config write: the row's current version (the `ETag` carries the same token) — re-read, reapply, retry.

## Types

### Actor

Who acted — the principal behind a command, a row's maker or its concluder: a member (USER, id = the user id), an API key the organisation issued (API_KEY, id = the API key id), or the platform itself (MACHINE, id 0 — a connector's report, an algo instance's order, the door's own write). The kind's value set is append-only: a consumer READING an unknown kind treats the actor as unknown, never as an error.

- `kind` (enum, required) — The kind of principal; which id space `id` names.
  - Allowed values: `USER`, `API_KEY`, `MACHINE`
- `id` (integer, required) — The principal's id in its kind's space: a user id, an API key id, or 0 for the platform itself.

### ErrorBody

What a refusal states. Since `0.12.0` every refusal carries all four members; a member below it sends `code`, sometimes `message`, and neither of the others.

- `code` (string, required) — The code to branch on — stable and open (before 1.0.0 a minor may remove one, its changelog naming it): treat one you do not know by its HTTP status. The gateway's: - 400: `MALFORMED_REQUEST`, `MISSING_IDEMPOTENCY_KEY`, `INVALID_IDEMPOTENCY_KEY`, `INVALID_IF_MATCH`, `INVALID_CURSOR` - 401: `UNAUTHENTICATED` - 403: `FORBIDDEN_PRINCIPAL`, `NOT_REGISTERED`, `INVITATION_EXPIRED`, `EMAIL_UNVERIFIED`, `ORG_NOT_ACTIVE`, `CAPABILITY_DENIED` - 404: `NOT_FOUND`, `UNKNOWN_OPERATION`, `ROUTE_NOT_FOUND` (no route answers the path) - 405: `METHOD_NOT_ALLOWED` - 409: `IDEMPOTENCY_KEY_REUSED`, `INTAKE_KEY_REUSED`, `KEY_ALREADY_REGISTERED`, `CONNECTION_DOWN` (`POST /transfers`), `EXCEEDS_MARGIN_HEADROOM`, `HEADROOM_UNKNOWN` (a transfer's submit and its approval) - 413: `TOO_LARGE`, `PAYLOAD_TOO_LARGE`, `DOCUMENT_TOO_LARGE` - 422: a reference this member will not send: `INSTRUMENT_NOT_LIVE`, `ACCOUNT_NOT_ACTIVE` (`POST /orders`), `REFERENCE_UNKNOWN_INSTRUMENT`, `REFERENCE_INSTRUMENT_NOT_LIVE`, `REFERENCE_UNKNOWN_ACCOUNT` (an algo document); `VENUE_UNSUPPORTED`, `DEDICATED_KEY`, `DESTINATION_NOT_ALLOWED` - 428: `PRECONDITION_REQUIRED` - 429: `INBOX_FULL`, `IN_FLIGHT_FULL`, `RATE_LIMITED` - 500: `INTERRUPTED`, `INTERNAL_ERROR`, `PROJECTION_MISS` - 503: `NOT_PRIMED`, `NOT_SERVING`, `OWNER_ABSENT`, `INTAKE_UNAVAILABLE`, `BALANCES_UNAVAILABLE`, `POSITIONS_UNAVAILABLE`, `RISK_UNAVAILABLE`, `TRANSFERS_UNAVAILABLE`, `ALGOS_UNAVAILABLE`, `NOTIFICATIONS_UNAVAILABLE`, `TICKETS_UNAVAILABLE`, `REGISTRATION_PENDING`, `PROJECTION_BEHIND`, `LOST`, `REJECTED_NOT_REGISTERED`, `REJECTED_NOT_ACTIVE` The record owners' refusals ride verbatim — `OrgRegisterRejected.reason`, `OrderRejected.reason`, `AlgoRejected.reason`, `RiskLimitRejectReason`, `RiskAdjustmentRejectReason`, `ManualExecutionRejectReason`, `TransferRejectReason` and `NotificationEndpointRejected.reason` list them; the guide maps each to its status.
- `message` (string, required) — For display only; its wording may change at any time.
- `requestId` (string, required) — The request's id, also sent as X-Request-Id; quote it to support.
- `retryable` (boolean, required) — Whether sending the identical request again, its `Idempotency-Key` included, after `Retry-After` or a short pause, can succeed with nothing else changed. `false` where something must change first: the request, its key, its precondition, the caller's standing, or the platform's own records or deployment. A refusal the record owner judged is always `false`: it is the recorded answer to its key, which replays it.

## Examples

**Request**

```json
{
  "name": "name"
}
```

**Response**

```json
{
  "apiKeyId": 1,
  "capabilities": [
    "users:manage"
  ],
  "createdAtNs": "createdAtNs",
  "createdBy": {
    "kind": "USER",
    "id": 1
  },
  "globalSequence": "globalSequence",
  "lastActiveAtNs": "lastActiveAtNs",
  "name": "name",
  "orgId": 1,
  "status": "UNKNOWN",
  "version": "version",
  "rotatedBy": {
    "kind": "USER",
    "id": 1
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.example.com/api-keys/1"

payload = { "name": "name" }
headers = {
    "Idempotency-Key": "Idempotency-Key",
    "If-Match": "If-Match",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.example.com/api-keys/1';
const options = {
  method: 'PUT',
  headers: {
    'Idempotency-Key': 'Idempotency-Key',
    'If-Match': 'If-Match',
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: '{"name":"name"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.example.com/api-keys/1"

	payload := strings.NewReader("{\n  \"name\": \"name\"\n}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("Idempotency-Key", "Idempotency-Key")
	req.Header.Add("If-Match", "If-Match")
	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.example.com/api-keys/1")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Idempotency-Key"] = 'Idempotency-Key'
request["If-Match"] = 'If-Match'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"name\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api.example.com/api-keys/1")
  .header("Idempotency-Key", "Idempotency-Key")
  .header("If-Match", "If-Match")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"name\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.example.com/api-keys/1', [
  'body' => '{
  "name": "name"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
    'Idempotency-Key' => 'Idempotency-Key',
    'If-Match' => 'If-Match',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.example.com/api-keys/1");
var request = new RestRequest(Method.PUT);
request.AddHeader("Idempotency-Key", "Idempotency-Key");
request.AddHeader("If-Match", "If-Match");
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"name\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Idempotency-Key": "Idempotency-Key",
  "If-Match": "If-Match",
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["name": "name"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/api-keys/1")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```