# Get Crypto Mode

`GET /crypto/mode` · Core · Encryption

Returns the project's key custody mode (`PLATFORM_MANAGED`, `SKR`, `BYOK` or `HYOK`), its `route`, and an opaque `epoch` that changes with every custody transition. Call it before every encrypt, with no caching.

`route` says where the encrypt runs, either `server` (`POST /crypto/encrypt`, sending this `epoch` as `custodyEpoch`) or `client` (in your process against your own KMS). Follow `route`, not the mode: a self-deployed BYOK or HYOK project is `server`. If custody moves between this check and the encrypt, the encrypt is refused with `409 K9O_ZK_STORE_FLOW_REQUIRED` before any key work, carrying the new mode, route and epoch; check again.

Always pass the `crypt` your next encrypt will use (the SDK does): the caller must be allowed to encrypt on it. Without it, the caller needs a crypto grant on every crypt, so a caller whose bound policy names only specific crypts must pass `crypt`. Extensions and end users are refused. Returns nothing else about the project's custody.

## Parameters

| Name | In | Required | Description |
|---|---|---|---|
| `crypt` | query | no | The crypt the next encrypt will use; always pass it (the SDK does). Without it the caller needs a crypto grant on every crypt, so a bound policy naming only specific crypts must pass it |
| `projectSlug` | path | yes | The project's slug: the path segment after `@`. It is unique within the org. Example: `"storefront"`. |

## Responses

- **200**: Success

| Field | Type | Required | Description |
|---|---|---|---|
| `data` | object | yes | How the project's next encrypt must run, and the custody epoch to send with it. |
| `data.custodyMode` | enum ("PLATFORM_MANAGED", "SKR", "BYOK", "HYOK") | yes | The project's key custody mode |
| `data.route` | enum ("client", "server") | yes | Where the next encrypt runs: `client` in your process against your own KMS, `server` through POST /crypto/encrypt. Follow this, not custodyMode |
| `data.epoch` | string | yes | Opaque; changes with every custody transition. Send it as custodyEpoch on the encrypt this check precedes |
| `meta` | object | yes |  |


## Errors

| HTTP | Code | When |
|---|---|---|
| 400 | `K9O_INVALID_FIELD_VALUE` | crypt does not match ^[a-z0-9-]{1,64}$. |
| 401 | `K9O_UNAUTHENTICATED` | The caller is not authenticated. |
| 403 | `K9O_ACCESS_DENIED` | The caller has no access to this project. |
| 403 | `K9O_IAM_POLICY_DENIED` | The caller may not encrypt on this crypt (or, without crypt, on every crypt). |
| 403 | `K9O_PAT_COLLECTION_NOT_PERMITTED` | A personal access token scoped to named crypts asked about another crypt, or about every crypt. |
| 403 | `K9O_EXTENSION_PERMISSION_DENIED` | Extensions use k9o.kibo, not the crypto resource. |
| 403 | `K9O_RBAC_DENY` | End users cannot call the crypto resource. |
| 410 | `K9O_PROJECT_ZEROIZED` | The project's key has been zeroized. |
| 503 | `K9O_KEY_SERVICE_UNAVAILABLE` | The key service could not answer. No mode means no encrypt; retry. |

## Code samples

### cURL

```bash
curl -X GET 'https://<org>.api-<region>.k9o.io/@storefront/crypto/mode' \
  -H 'Authorization: Bearer $K9O_TOKEN'
```

### fetch

```javascript
const res = await fetch('https://<org>.api-<region>.k9o.io/@storefront/crypto/mode', {
  method: 'GET',
  headers: {
    'Authorization': `Bearer ${process.env.K9O_TOKEN}`
  },
});
const { data, meta } = await res.json();
```

### k9o CLI

```bash
k9o crypto mode
```

### @k9o/core

```typescript
// const k9o = new K9o({ orgSlug: 'playground', projectSlug: 'storefront', apiKey: 'k9o_…' })
const { data } = await k9o.crypto.mode()
```

### k9o

```python
# k9o = create_client(org_slug="playground", project_slug="storefront", api_key="k9o_…")
response = k9o.crypto.mode()
```

### sdk-go

```go
// ctx := context.Background()
// client, _ := k9o.NewClient(k9o.ClientOpts{OrgSlug: "playground", ProjectSlug: "storefront", APIKey: "k9o_…"})
data, _, kerr := client.Crypto.Mode(ctx)
```

### k9o

```rust
// let k9o = Client::new(ClientOpts { org_slug: "playground".into(), project_slug: "storefront".into(), api_key: "k9o_…".into() })?;
let resp = k9o.crypto.mode().await?
```

### dev.k9o:core

```java
// K9o k9o = K9o.createClient(K9o.Opts.builder().orgSlug("playground").projectSlug("storefront").apiKey("k9o_…").build());
var response = k9o.crypto().mode()
```

### K9o.Core

```c#
// var k9o = K9oClient.Create(new K9oOptions { OrgSlug = "playground", ProjectSlug = "storefront", ApiKey = "k9o_…" });
var response = await k9o.Crypto.ModeAsync()
```

### k9o

```ruby
# k9o = K9o.create_client(org_slug: "playground", project_slug: "storefront", api_key: "k9o_…")
response = k9o.crypto.mode()
```

### k9o/sdk

```php
// $k9o = K9oClient::create(['org_slug' => 'playground', 'project_slug' => 'storefront', 'api_key' => 'k9o_…']);
$response = $k9o->crypto->mode()
```


Canonical page: https://docs.kilimanjaro.dev/api-playground/core/get-crypto-mode
