# List csrf

URL: https://docs.hanzo.ai/docs/openapi/account/get-account-csrf

> Mints the anti-forgery token a browser echoes as X-CSRF-Token on every change it asks for.

`GET /v1/account/csrf`

> [Account →](https://docs.hanzo.ai/docs/openapi/account) · [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|               |                                        |
| ------------- | -------------------------------------- |
| **Address**   | `https://api.hanzo.ai/v1/account/csrf` |
| **Method**    | `GET`                                  |
| **Operation** | `get_account_csrf`                     |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY` |

Mints the anti-forgery token a browser echoes as X-CSRF-Token on
every change it asks for. The token is bound to the caller's validated identity
and expires, so one minted for one identity cannot authorize a change as another.

It is answered no-store, so it is never cached by a shared proxy. This is the
same-origin endpoint the embedded console reads — the Same-Origin Policy is what
stops a cross-site page from reading the response and forging a change.

## Request

`GET /v1/account/csrf` takes no parameters and no body — the credential is the whole request.

## Response

| Status    | Body             | Meaning |
| --------- | ---------------- | ------- |
| `200`     | account.csrfResp | ok      |
| `default` | problem-details  | refused |

`200` body — 2 fields.

| Field       | In   | Type            | Always | Description                                                 |
| ----------- | ---- | --------------- | ------ | ----------------------------------------------------------- |
| `csrfToken` | body | string          | —      | Token is the value to send back in the X-CSRF-Token header. |
| `expiresIn` | body | integer (int64) | —      | ExpiresIn is the token's lifetime in seconds.               |

Failure carries the platform error shape — see [Errors](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

```bash
hanzo account csrf
```

**SDK**

**.ts**

```ts
import { Configuration, AccountApi } from 'hanzoai';

const api = new AccountApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getAccountCsrf();
```

**.py**

```python
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import AccountApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = AccountApi(client).get_account_csrf()
```

**.go**

```go
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.AccountAPI.GetAccountCsrf(context.Background()).Execute()
if err != nil {
	return err
}
```

**.rs**

```rust
use hanzo_client::apis::{configuration::Configuration, account_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = account_api::get_account_csrf(&cfg, Default::default()).await?;
```

**.java**

```java
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.AccountApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new AccountApi(client).getAccountCsrf();
```

**HTTP**

```bash
curl https://api.hanzo.ai/v1/account/csrf \
  -H "Authorization: Bearer $HANZO_API_KEY"
```

**MCP**

Tool `account`, op `get_account_csrf` — POST the JSON-RPC envelope to `https://api.hanzo.ai/v1/mcp`.

```bash
curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "account",
         "arguments": {
           "op": "get_account_csrf",
           "input": {}
         }
       }
     }'
```

---

[Account API](https://docs.hanzo.ai/docs/openapi/account) · [All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
