Reference
HTTP API
Every endpoint, with its request and its answer.
The API is JSON over HTTP. This page covers contract version 0.1.0, which every response names in its X-Contract-Version header. In the examples, $WRIT_API is the API's address.
Conventions
| Bodies | application/json in both directions. Request bodies are strict: an unknown key is a VALIDATION_ERROR. |
| Amounts | Base units as decimal strings, never JSON numbers. |
| Addresses and signatures | Base58. |
| Times | ISO 8601 in UTC. |
| Failures | One envelope for every failed request. Errors lists the codes. |
| Request id | Every response carries X-Request-Id. |
| Rate limits | POST /auth/verify 20 a minute, POST /v1/intents 60 a minute, POST /v1/chat/messages 30 a minute. Past the limit the answer is RATE_LIMITED. |
Responses can gain fields and enum values in later versions. A client should ignore keys it does not know.
Authentication
There are two kinds of token, both sent as Authorization: Bearer <token>.
| Token | Who holds it | What it opens |
|---|---|---|
| Session token | the owner, after signing in | every /v1 endpoint except POST /v1/intents |
| Agent token | an outside agent | POST /v1/intents only |
A session starts with Sign-In With Solana: fetch the sign-in input from GET /auth/nonce, have the owner's wallet sign it, and send the signed bytes to POST /auth/verify. A session lasts until its expiresAt. A call to an owner endpoint without one answers UNAUTHORIZED. An agent token is created by the owner with POST /v1/agents/tokens.
Intents
POST /v1/intentsagent tokenSends one intent for the agent wallet the token belongs to. The body is the TIS itself.
curl -X POST "$WRIT_API/v1/intents" \
-H "Authorization: Bearer $WRIT_AGENT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"tis":"1","action":"transfer","params":{"asset":"SOL","to":"CvaC1sSWgsG9UZT3fU8R2TRhrFcpxa1d2mR6pU3mTdgv","amount":"0.5"},"reason":"User asked to pay Maya 0.5 SOL for design work."}'The answer has three fields.
pdrPDR or nullThe record.
nullfor an intent withaction: "none".replystring or nullThe
replyof anoneintent, otherwisenull.transactiontransaction or nullThe transaction of the record.
nullwhen there is no record.
An allowed intent, answered at sent:
{
"pdr": {
"id": "1ab45685-fd95-4350-894d-9b132332dd87",
"pdr": "1",
"tis": {
"tis": "1",
"action": "transfer",
"params": {
"to": "CvaC1sSWgsG9UZT3fU8R2TRhrFcpxa1d2mR6pU3mTdgv",
"asset": "SOL",
"amount": "0.5"
},
"reason": "User asked to pay Maya 0.5 SOL for design work."
},
"checks": [
{
"rule": "schema",
"detail": "valid TIS v1, compiled to 3 instructions",
"result": "pass"
},
{
"rule": "paused",
"detail": "wallet is active",
"result": "pass"
},
{
"rule": "program_allowlist",
"detail": "System allowed; ComputeBudget always permitted",
"result": "pass"
},
{
"rule": "daily_spend",
"detail": "0 + 0.500005001 of 2 SOL in 24h",
"result": "pass"
},
{
"rule": "token_limits",
"detail": "moves no tokens",
"result": "n/a"
},
{
"rule": "no_unlimited_approval",
"detail": "grants no approval",
"result": "n/a"
}
],
"source": "agent_token",
"wallet": "BrpKxDbVNo9KmzXy6TULJACV2oh7msEKUXeGurFaLihv",
"outflow": {
"source": "simulation",
"tokens": [],
"unknown": [],
"lamports": "500005001"
},
"decision": "allow",
"programs": [
"11111111111111111111111111111111",
"ComputeBudget111111111111111111111111111111"
],
"approvals": [],
"created_at": "2026-11-28T22:44:18.476Z",
"tis_digest": "ffabb16b1b92d9f5ce521536c52cb893370290896c830c7b76cb7e601ef8deac",
"policy_digest": "c958b5c7f8fd5818451f8abcc30a0f2494302e935ce5e1a1bcde9ddea57b2293",
"message_digest": "fb8c79878cc6228eb9b81cbf3646af13151b32f0a420ca03324b80e74f88e39e",
"policy_version": 1
},
"reply": null,
"transaction": {
"state": "sent",
"signature": "2h248HruM2rC3HJgWU4gqKyRBrWxbEg14KZaMGPYy2pHw3tfV5neaAKdpXxMnnMAGhxRtEEDU4CbjjE1tZYG31z5",
"explorerUrl": "<link to the signature's page>",
"error": null,
"updatedAt": "2026-11-28T22:44:18.575Z"
}
}The agent token cannot read records. To follow the transaction to confirmed, an outside agent reads the signature's status from the cluster. The owner reads the same record with GET /v1/records/{id}.
A denied intent is also a 200. The record says which rule failed and the transaction is sealed:
{
"decision": "deny",
"failed": [
{
"rule": "daily_spend",
"detail": "0.500005001 + 3.000005001 of 2 SOL in 24h",
"result": "fail"
}
],
"transaction": {
"state": "sealed",
"signature": null,
"explorerUrl": null,
"error": null,
"updatedAt": "2026-11-28T22:44:20.247Z"
}
}Any JSON object is accepted as a body. One that is not a valid TIS is recorded and denied by the schema rule; it is not a VALIDATION_ERROR.
Errors: UNAUTHORIZED without an agent token or with one the API does not know, TOKEN_REVOKED, WALLET_REQUIRED when the owner has no agent wallet, RATE_LIMITED.
{
"error": {
"code": "UNAUTHORIZED",
"message": "Send an agent token as Authorization: Bearer writ_….",
"retryable": false,
"stage": "auth"
}
}Sign-in
GET /auth/nonceReturns the Sign-In With Solana input for the owner's wallet to sign, and a nonceToken to send back with the proof.
inputobjectdomain,statement,uri,version,chainId,nonce,issuedAt,expirationTime. Pass it to the wallet'ssignInunchanged.nonceTokenstringSend it with
POST /auth/verify.
POST /auth/verifyChecks the signed message and opens a session.
publicKeystring (base58)requiredThe owner's wallet address.
signedMessagestring (base64), at most 8192 charactersrequiredThe exact bytes the wallet signed, as the wallet returned them.
signaturestring (base64)requiredThe ed25519 signature over those bytes.
nonceTokenstringThe value from
GET /auth/nonce.
Answers wallet (the owner's address), expiresAt and token, the session token.
Errors: UNAUTHORIZED when the signature does not verify or the sign-in request expired, VALIDATION_ERROR, RATE_LIMITED.
GET /auth/sessionsessionAnswers wallet and expiresAt for the session the token carries. UNAUTHORIZED when there is none.
POST /auth/logoutsessionEnds the session. Answers 204 with no body.
The agent wallet
GET /v1/walletsessionAnswers wallet: the owner's agent wallet, or null if none was created.
addressaddressThe agent wallet's address. Send SOL or tokens here to fund it.
lamportsstring (base units)Its SOL balance.
tokensarrayIts token balances:
mint,symbol(ornull),amount,decimals.spendobjectWhat the wallet sent in the window against the caps.
windowHoursis 24.solhasusedandcapin lamports.tokenshas one entry per capped mint:mint,symbol,decimals,used,cap.pausedbooleanWhether the policy in force is paused.
policyVersionintegerThe number of the policy version in force.
recentRecordsarray of record summariesThe latest records, newest first. Same shape as the items of
GET /v1/records.
{
"wallet": {
"address": "BrpKxDbVNo9KmzXy6TULJACV2oh7msEKUXeGurFaLihv",
"lamports": "4499994999",
"tokens": [],
"spend": {
"windowHours": 24,
"sol": {
"used": "500005001",
"cap": "2000000000"
},
"tokens": [
{
"mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"cap": "50000000",
"used": "0",
"symbol": "USDC",
"decimals": 6
}
]
},
"paused": false,
"policyVersion": 1,
"recentRecords": [
{
"id": "6ed81770-138a-4d1b-bbb6-eab82fcfbfda",
"kind": "intent",
"decision": "deny",
"action": "transfer",
"summary": "20 USDC to Ab1X…mTTp",
"amount": {
"asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"symbol": "USDC",
"amount": "20000000",
"decimals": 6
},
"source": "agent_token",
"state": "sealed",
"createdAt": "2026-11-28T22:44:20.410Z"
}
]
}
}POST /v1/walletsessionCreates the owner's agent wallet and writes the default policy as version 1. The body is an empty object.
Answers 201 with the same shape as GET /v1/wallet:
{
"wallet": {
"address": "BrpKxDbVNo9KmzXy6TULJACV2oh7msEKUXeGurFaLihv",
"lamports": "0",
"tokens": [],
"spend": {
"windowHours": 24,
"sol": {
"used": "0",
"cap": "2000000000"
},
"tokens": [
{
"mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"cap": "50000000",
"used": "0",
"symbol": "USDC",
"decimals": 6
}
]
},
"paused": false,
"policyVersion": 1,
"recentRecords": []
}
}Errors: WALLET_EXISTS when the owner already has one, SIGNER_UNAVAILABLE.
POST /v1/withdrawalssessionSends SOL, a token or both from the agent wallet to the owner's own address. The destination is not a parameter. A withdrawal is the owner's action: it is not judged by the rules and does not count toward the caps.
lamportsstring (u64, above zero) or "all"How much SOL.
"all"is the balance less the network fee.tokenobjectmint, andamountin base units or"all".
At least one of the two is required. A token withdrawal opens the owner's associated token account if it does not exist, and "all" for SOL then also leaves that account's rent. Answers 201, usually at sent:
{
"id": "cmx0zze4t00600jjylhz1nl3k",
"to": "32cWD8vDdcUkZQEUxSwgUoA86RRjCTBo5ZZz6zq6bd7i",
"lamports": "100000000",
"token": null,
"transaction": {
"state": "sent",
"signature": "rmrmNBkjy4BLN912Vm4tYse7VdFrSBdcsdbygakwdR8a5cFFn8MgZS4mzqrQLugbfKs8fvGU77j9BHW7uVbCMNS",
"explorerUrl": "<link to the signature's page>",
"error": null,
"updatedAt": "2026-11-28T22:44:25.047Z"
},
"createdAt": "2026-11-28T22:44:25.037Z"
}to is the owner's address. lamports and token are null when not withdrawn. The withdrawal also appears in GET /v1/records with kind: "withdrawal".
Errors: INSUFFICIENT_FUNDS, WALLET_REQUIRED, SIGNER_UNAVAILABLE, VALIDATION_ERROR.
Policy
GET /v1/policysessionAnswers the policy in force. WALLET_REQUIRED before the agent wallet exists.
versionintegerThe version's number.
policyobjectThe five fields.
digeststring, 64 hex charactersThe policy's digest, the value records cite as
policy_digest.createdAtstringWhen this version was saved.
{
"version": 1,
"policy": {
"paused": false,
"tokenLimits": {
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v": "50000000"
},
"dailySolLamports": "2000000000",
"programAllowlist": [
"11111111111111111111111111111111",
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
],
"blockUnlimitedApprovals": true
},
"digest": "c958b5c7f8fd5818451f8abcc30a0f2494302e935ce5e1a1bcde9ddea57b2293",
"createdAt": "2026-11-28T22:44:17.200Z"
}POST /v1/policysessionSaves the whole policy as a new version. The body is the five fields, all required. Answers 201 with the new version in the shape of GET /v1/policy.
curl -X POST "$WRIT_API/v1/policy" \
-H "Authorization: Bearer $WRIT_SESSION" \
-H "Content-Type: application/json" \
-d '{"paused":false,"dailySolLamports":"5000000000","tokenLimits":{"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v":"50000000"},"programAllowlist":["11111111111111111111111111111111","TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA","ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"],"blockUnlimitedApprovals":true}'Errors: VALIDATION_ERROR with fieldErrors, WALLET_REQUIRED.
POST /v1/policy/pausesessionPauses or resumes the agent wallet. It writes a new policy version that differs only in paused. If the wallet is already in that state, it answers the current version and writes nothing.
pausedbooleanrequiredtrueto pause,falseto resume.
Answers the new version:
{
"version": 2,
"policy": {
"paused": true,
"tokenLimits": {
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v": "50000000"
},
"dailySolLamports": "2000000000",
"programAllowlist": [
"11111111111111111111111111111111",
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
],
"blockUnlimitedApprovals": true
},
"digest": "3800a9406d7b5d7fb8b3d80a06f0f86647d276f5d9a01cd77ffb1467e17f39cf",
"createdAt": "2026-11-28T22:44:20.762Z"
}Records
GET /v1/recordssessionLists the agent wallet's records, newest first: every judged intent and every withdrawal.
decisionquery: allow or denyOnly records with that decision.
limitquery: integer, 1 to 100Page size. 24 if omitted.
cursorquery: stringThe
page.nextCursorof the page before.
Answers items, page with nextCursor (or null) and hasMore, and asOf. Each item is a record summary:
idstringThe record's id.
kindstringintent, a judged intent with a PDR, orwithdrawal.decisionstringallowordeny.actionstringThe intent's action,
withdrawfor a withdrawal, orinvalidfor an intent that failed the schema.summarystringOne line describing it.
amountobject or nullasset(SOLor a mint),symbol(ornull),amountin base units,decimals.sourcestringchat,agent_tokenorowner.statestringThe transaction state.
createdAtstringWhen it was written.
{
"items": [
{
"id": "cmx0zze4t00600jjylhz1nl3k",
"kind": "withdrawal",
"decision": "allow",
"action": "withdraw",
"summary": "Withdraw to 32cW…bd7i",
"amount": {
"asset": "SOL",
"symbol": "SOL",
"amount": "100000000",
"decimals": 9
},
"source": "owner",
"state": "confirmed",
"createdAt": "2026-11-28T22:44:25.037Z"
},
{
"id": "cab665b5-9e62-4537-9eb4-56433702ab40",
"kind": "intent",
"decision": "allow",
"action": "transfer",
"summary": "0.5 SOL to CvaC…Tdgv",
"amount": {
"asset": "SOL",
"symbol": "SOL",
"amount": "500000000",
"decimals": 9
},
"source": "chat",
"state": "confirmed",
"createdAt": "2026-11-28T22:44:22.564Z"
}
],
"page": {
"nextCursor": "2",
"hasMore": true
},
"asOf": "2026-11-28T22:44:26.170Z"
}GET /v1/records/{id}sessionAnswers one record in full.
recordrecord summaryAs in the list.
pdrPDR or nullThe record the engine wrote.
nullfor a withdrawal.policypolicy version or nullThe policy version the record ran under, in the shape of
GET /v1/policy.transactiontransactionThe transaction and its current state.
Errors: NOT_FOUND.
{
"error": {
"code": "NOT_FOUND",
"message": "That record was not found.",
"retryable": false,
"stage": "read"
}
}Agent tokens
GET /v1/agents/tokenssessionAnswers items, the owner's agent tokens, revoked ones included.
idstringThe token's id, used to revoke it.
namestringThe name the owner gave it.
prefixstringThe first nine characters of the value, to tell tokens apart.
createdAtstringWhen it was created.
lastUsedAtstring or nullWhen it last sent an intent.
revokedAtstring or nullWhen it was revoked.
POST /v1/agents/tokenssessionCreates an agent token.
namestring, 1 to 64 charactersrequiredA name to recognise it by.
Answers 201 with token and value. value is the secret the agent sends. It is in this answer only; later calls return the prefix.
{
"token": {
"id": "cmx0zz8ny005i0jjycwpv8ng2",
"name": "billing agent",
"prefix": "writ_tHa1",
"createdAt": "2026-11-28T22:44:17.950Z",
"lastUsedAt": null,
"revokedAt": null
},
"value": "writ_tHa1wfASwphUmpJNMUVnmlw94GD6rUdSOMASPEfOyfY"
}POST /v1/agents/tokens/{id}/revokesessionRevokes an agent token. No body. Answers the token with revokedAt set. Calls made with a revoked token answer TOKEN_REVOKED. An unknown id answers NOT_FOUND.
{
"id": "cmx0zz8ny005i0jjycwpv8ng2",
"name": "billing agent",
"prefix": "writ_tHa1",
"createdAt": "2026-11-28T22:44:17.950Z",
"lastUsedAt": "2026-11-28T22:44:20.393Z",
"revokedAt": "2026-11-28T22:44:20.735Z"
}Chat
GET /v1/chat/messagessessionAnswers items, the owner's conversation with the chat agent, oldest first.
idstringThe message's id.
rolestringowneroragent.textstringWhat was said.
createdAtstringWhen.
tisobject or nullOn an agent message, the intent of that turn,
noneincluded.pdrPDR or nullThe record for that intent.
transactiontransaction or nullThe record's transaction.
POST /v1/chat/messagessessionSends the owner's message and answers with the agent's turn.
textstring, 1 to 2000 charactersrequiredThe message.
Answers message, the owner's message as stored, and reply, the agent's message with its tis, pdr and transaction. The intent goes through the same engine as POST /v1/intents, and its record has the source chat.
{
"message": {
"id": "cmx0zzbri005u0jjym0ugsn2b",
"role": "owner",
"text": "Send Maya 0.5 SOL",
"createdAt": "2026-11-28T22:44:21.966Z",
"tis": null,
"pdr": null,
"transaction": null
},
"reply": {
"id": "cmx0zzcb8005x0jjyjyt6gzaq",
"role": "agent",
"text": "Writing a transfer of 0.5 SOL to CvaC1sSWgsG9UZT3fU8R2TRhrFcpxa1d2mR6pU3mTdgv. The policy allowed it.",
"createdAt": "2026-11-28T22:44:22.676Z",
"tis": {
"tis": "1",
"action": "transfer",
"params": {
"to": "CvaC1sSWgsG9UZT3fU8R2TRhrFcpxa1d2mR6pU3mTdgv",
"asset": "SOL",
"amount": "0.5"
},
"reason": "Owner asked: Send Maya 0.5 SOL"
},
"pdr": "the record, as in PDR v1",
"transaction": {
"state": "sent",
"signature": "3epY5K746Uk9Z1AfZ6dwPX1mp3S5MxP5oYP7y5bWxAA12JtF9jbXJ2ZXsGaHjqV1MFwZrHw5Mp5JJCa3CQTkFo6D",
"explorerUrl": "<link to the signature's page>",
"error": null,
"updatedAt": "2026-11-28T22:44:22.665Z"
}
}
}Errors: AGENT_UNAVAILABLE when the agent could not answer, WALLET_REQUIRED, RATE_LIMITED.
Health
GET /healthstatusstringokorwaiting.modestringlive, orfixturewhen the API serves fixtures.agentstringWhich chat agent answers:
claudeorscripted.clusterstringThe Solana cluster the API sends transactions to.
swapFeeobject or nullThe platform fee on swaps:
bpsand the feeaccount.nullwhen swaps carry no fee.writMintaddress or nullThe $WRIT mint.
nullwhile there is none.contractVersionstringThe contract version.