intents_submit
const url = 'https://example.com/intents';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"authorship":"Unsigned","intent":{"attrs":{"fields":{"acceptable_genres":{"Set":{"String":["Fantasy","SciFi"]}},"condition":{"String":"new"},"max_price_cents":{"Int":3000}}},"id":"4ba223e7-fcb0-442e-96f0-b4a2b07080ca","policy_id":"4Bh9qrxKWLfPEUFs6hKqtzL75dPQyj9hSLHmDr8wqDap"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/intents \ --header 'Content-Type: application/json' \ --data '{ "authorship": "Unsigned", "intent": { "attrs": { "fields": { "acceptable_genres": { "Set": { "String": [ "Fantasy", "SciFi" ] } }, "condition": { "String": "new" }, "max_price_cents": { "Int": 3000 } } }, "id": "4ba223e7-fcb0-442e-96f0-b4a2b07080ca", "policy_id": "4Bh9qrxKWLfPEUFs6hKqtzL75dPQyj9hSLHmDr8wqDap" } }'Submit an intent and its authorship.
The authorship is verified (a signature when present; unsigned intents are accepted where the orchestrator permits it) and the referenced policy must exist before the intent is stored.
Request Body required
Section titled “Request Body required ”An intent together with its [Authorship].
When signed, the signature is over the JCS (JSON Canonicalization Scheme,
RFC 8785) serialization of the intent. A signer serializes the intent with
JCS and signs those bytes, for instance in TypeScript:
import canonicalize from "canonicalize";
const jcs = canonicalize(json_intent)
const bytes = new TextEncoder().encode(jcs)
const signed = signer.signBytes(bytes)object
A signature over the JCS serialization of the intent.
object
Ed25519 signature
object
Ed25519 signature
object
The [PubKey] of the signer
The [Signature]
Passkey signature
object
Passkey signature
object
The bs58-encoded bytes of the authenticator data.
String containing the client data JSON.
This field is a string because JSON does not define property order, and we must guarantee that the UTF8 bytes of this string are exactly the same as those used by the passkey device.
ECDSA Public Key
ECDSA signature
Multisig signature
object
Multisig signature
object
The multisig descriptor to be checked against
object
The list of signers and their associated weight
object
The threshold above which a subset of the signers can emit a valid signature
The list of signatures
Ed25519 signature
object
Ed25519 signature
object
The [PubKey] of the signer
The [Signature]
Passkey signature
object
Passkey signature
object
The bs58-encoded bytes of the authenticator data.
String containing the client data JSON.
This field is a string because JSON does not define property order, and we must guarantee that the UTF8 bytes of this string are exactly the same as those used by the passkey device.
ECDSA Public Key
ECDSA signature
No signature; authorship is not cryptographically asserted.
The intent that is being authorized.
object
Attribute values that parameterize the policy.
In JSON, omit this field instead of putting "attrs": null.
object
object
Unique identifier for this intent.
ID of the policy that defines the rules for fulfilling this intent.
Example
{ "authorship": "Unsigned", "intent": { "attrs": { "fields": { "acceptable_genres": { "Set": { "String": [ "Fantasy", "SciFi" ] } }, "condition": { "String": "new" }, "max_price_cents": { "Int": 3000 } } }, "id": "4ba223e7-fcb0-442e-96f0-b4a2b07080ca", "policy_id": "4Bh9qrxKWLfPEUFs6hKqtzL75dPQyj9hSLHmDr8wqDap" }}Responses
Section titled “ Responses ”Intent accepted
Bad request
object
Example generated
{ "message": "example"}Intent already exists
object
Example generated
{ "message": "example"}Body is valid JSON but does not match the schema
object
Example generated
{ "message": "example"}Internal error
object
Example generated
{ "message": "example"}