---
title: "Update"
url: "https://developer.incode.com/api-reference/api-key-put/"
section: "api-reference"
group: "Onboarding"
version: "v1.1"
status: "live"
endpoint: "PUT /omni/api-key"
---
# Update

`PUT /omni/api-key`

Base URL: `https://demo-api.incodesmile.com` — Incode demo environment

Validate/invalidate API key for current user's organization. If user is super admin, parameter apiKey can be provided
to specify organization for which the key should be adjusted (ignored otherwise). User is not allowed to invalidate last
valid key of the belonging organization. Super admin user can invalidate last valid keys of other organizations
(effectively revoking their access to the application).

## Path & query parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `api-version` | header | string | yes |  |

## Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `valid` | boolean | yes | Key validity. |
| `name` | string |  | Key name. |
| `apiKey` | string |  | Organization reference. |

## Responses

### 200

OK

Response body (`application/json`):

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string |  | Key name. |
| `value` | string |  | Key value, sha1(clientId). |
| `clientId` | string |  | Key clientId, name + random 3 digits. |
| `valid` | boolean |  | Key validity. |
| `createdAt` | integer (int64) |  | Key creation timestamp. |
| `updatedAt` | integer (int64) |  | Key adjustment timestamp. |

### 400

Bad Request

Response body (`application/json`):

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `timestamp` | integer (int64) |  | UTC timestamp in milliseconds |
| `status` | integer (int32) |  | Custom error code or HTTP status code |
| `error` | string |  | HTTP status error |
| `message` | string |  | Custom error message |
| `path` | string |  | Endpoint path |
| `details` | object |  | Custom error details |

## Code samples

Generated from this endpoint's method, path, and the conventional Incode headers. The base URL is the Incode demo environment; replace `<YOUR_API_KEY>` with a key for your region.

### cURL

```bash
curl -X PUT https://demo-api.incodesmile.com/omni/api-key \
  -H "x-api-key: <YOUR_API_KEY>" \
  -H "api-version: 1.0" \
  -H "Content-Type: application/json" \
  -d '{
    "valid": false,
    "name": "",
    "apiKey": ""
  }'
```

### Node

```js
const res = await fetch("https://demo-api.incodesmile.com/omni/api-key", {
  method: "PUT",
  headers: {
      "x-api-key": "<YOUR_API_KEY>",
      "api-version": "1.0",
      "Content-Type": "application/json",
  },
    body: JSON.stringify({
      "valid": false,
      "name": "",
      "apiKey": ""
    }),
});
const data = await res.json();
```

### Python

```python
import requests

headers = {
    "x-api-key": "<YOUR_API_KEY>",
    "api-version": "1.0",
    "Content-Type": "application/json",
}
res = requests.put("https://demo-api.incodesmile.com/omni/api-key", headers=headers, json={
  "valid": False,
  "name": "",
  "apiKey": ""
})
data = res.json()
```

### Java

```java
HttpRequest req = HttpRequest.newBuilder()
    .uri(URI.create("https://demo-api.incodesmile.com/omni/api-key"))
    .header("x-api-key", "<YOUR_API_KEY>")
    .header("api-version", "1.0")
    .header("Content-Type", "application/json")
    .method("PUT", HttpRequest.BodyPublishers.ofString("{\n  \"valid\": false,\n  \"name\": \"\",\n  \"apiKey\": \"\"\n}"))
    .build();
HttpResponse<String> res = HttpClient.newHttpClient()
    .send(req, HttpResponse.BodyHandlers.ofString());
```

### Example response

```json
{
  "success": true,
  "status": "OK"
}
```
