Transaction records
Create a record
Create a transaction record for your project, usually with status prepared.
Endpoint
POST/v1/transactions
Creates a project-owned row. With project auth, projectId and organizationId are taken from credentials—do not send them. Default status is prepared.
Body
| Field | Required | Description |
|---|---|---|
| kind | Yes | transfer | swap | defi | approval | other |
| chainId | Yes | Valid Gray3 chain ID |
| from | Yes | Sender address |
| to | No | Recipient when known |
| value | No | Amount in base units (string) |
| tokenAddress | No | Token contract when not native |
| status | No | prepared | broadcast | confirmed | failed (default prepared) |
| txHash | No | Set if already submitted |
| unsignedPayload | No | Optional prepare payload snapshot |
| providerRefs | No | String map for your correlation ids |
Request
curl -sS -X POST "https://ledger.gray3.io/v1/transactions" \
-H "X-Gray-Project-Id: proj_your_project_id" \
-H "Authorization: Bearer gray_sk_your_secret" \
-H "Content-Type: application/json" \
-d '{
"kind": "transfer",
"chainId": "ethereum-sepolia",
"from": "0xYourAddress",
"to": "0xRecipient",
"value": "1000000000000000000",
"status": "prepared"
}'Response
HTTP 201 — new id is tx_….
HTTP 201 — success envelope wraps the payload in data.
json
{
"data": {
"_id": "tx_…",
"projectId": "proj_…",
"organizationId": "org_…",
"kind": "transfer",
"chainId": "ethereum-sepolia",
"from": "0xYourAddress",
"to": "0xRecipient",
"value": "1000000000000000000",
"status": "prepared",
"createdAt": "2026-03-01T10:00:00.000Z",
"updatedAt": "2026-03-01T10:00:00.000Z"
}
}Errors
Errors use HTTP { "error": { "code", "message", "retryable" } }. Branch on code, not the message text.
| Code | HTTP | When |
|---|---|---|
| unauthorized | 401 | Missing or invalid project credentials |
| invalid_argument | 400 | Bad kind, chainId, status, empty from/hash, or malformed body |
| not_found | 404 | Unknown transaction ID, or a record owned by another project |
| rate_limit_exceeded | 429 | Write or project throttle (retryable) |
json
{
"error": {
"code": "unauthorized",
"message": "Human-readable detail (may be sanitized).",
"retryable": false
}
}Next: link on Cloud broadcast or patch status yourself.