# Create sign

URL: https://docs.hanzo.ai/docs/openapi/wallet/post-wallet-by-id-sign

> Produces a secp256k1 signature from one of the caller org's wallets over a 32-byte digest, through whichever custody backend that wallet uses.

`POST /v1/wallet/{id}/sign`

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

|               |                                            |
| ------------- | ------------------------------------------ |
| **Address**   | `https://api.hanzo.ai/v1/wallet/{id}/sign` |
| **Method**    | `POST`                                     |
| **Operation** | `post_wallet_by_id_sign`                   |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY`     |

Produces a secp256k1 signature from one of the caller org's wallets over
a 32-byte digest, through whichever custody backend that wallet uses. Give it
either a `digest` (32 bytes as hex, signed verbatim) or a `message` (hashed
with Keccak256 first) — exactly one is required. The private key never leaves
its backend: KMS custody opens the sealed key in-process, MPC custody produces
a threshold signature on the ring. The answer carries the digest that was
signed alongside the signature, so a caller can verify what it got.

## Request

3 fields, body `application/json` (required).

| Field     | In   | Type   | Required | Description                                                                    |
| --------- | ---- | ------ | -------- | ------------------------------------------------------------------------------ |
| `id`      | path | string | yes      |                                                                                |
| `digest`  | body | string | —        | Digest is a pre-computed 32-byte digest as hex, with or without the 0x prefix. |
| `message` | body | string | —        | Message is arbitrary text to hash with Keccak256 and sign.                     |

## Response

| Status    | Body             | Meaning |
| --------- | ---------------- | ------- |
| `200`     | wallet.signature | ok      |
| `default` | problem-details  | refused |

`200` body — 4 fields.

| Field       | In   | Type   | Always | Description                                                                   |
| ----------- | ---- | ------ | ------ | ----------------------------------------------------------------------------- |
| `address`   | body | string | —      | Address is the wallet's on-chain address, the one this signature recovers to. |
| `digest`    | body | string | —      | Digest is the 32-byte digest that was signed, hex with an 0x prefix.          |
| `signature` | body | string | —      | Signature is the 65-byte secp256k1 signature, hex with an 0x prefix.          |
| `walletId`  | body | string | —      | WalletID is the wallet that signed.                                           |

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

## Examples

**CLI**

```bash
hanzo wallet sign <id>
```

**SDK**

**.ts**

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

const api = new WalletApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postWalletByIdSign({ id: 'id', digest: "<digest>", message: "<message>" });
```

**.py**

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

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = WalletApi(client).post_wallet_by_id_sign(id='id', digest="<digest>", message="<message>")
```

**.go**

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

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

**.rs**

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

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

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

**.java**

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

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

var result = new WalletApi(client).postWalletByIdSign();
```

**HTTP**

```bash
curl -X POST https://api.hanzo.ai/v1/wallet/<id>/sign \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "digest": "<digest>",
       "message": "<message>"
     }'
```

**MCP**

MCP reaches **wallet** through the `wallet` tool, which names its 7 operations with its own verbs — this one among them, under a name only MCP declares. `describe` explains any of them:

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

---

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