curl --request POST \
--url https://api.example.com/api/agent/consent/request \
--header 'Content-Type: application/json' \
--header 'X-Site-ID: <x-site-id>' \
--data '
{
"agent_name": "<string>",
"budget_cents": 5000000,
"scopes": [
"<string>"
],
"allowed_categories": [
"<string>"
],
"token_ttl_seconds": 2592000
}
'import requests
url = "https://api.example.com/api/agent/consent/request"
payload = {
"agent_name": "<string>",
"budget_cents": 5000000,
"scopes": ["<string>"],
"allowed_categories": ["<string>"],
"token_ttl_seconds": 2592000
}
headers = {
"X-Site-ID": "<x-site-id>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Site-ID': '<x-site-id>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agent_name: '<string>',
budget_cents: 5000000,
scopes: ['<string>'],
allowed_categories: ['<string>'],
token_ttl_seconds: 2592000
})
};
fetch('https://api.example.com/api/agent/consent/request', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/agent/consent/request",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'agent_name' => '<string>',
'budget_cents' => 5000000,
'scopes' => [
'<string>'
],
'allowed_categories' => [
'<string>'
],
'token_ttl_seconds' => 2592000
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Site-ID: <x-site-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/agent/consent/request"
payload := strings.NewReader("{\n \"agent_name\": \"<string>\",\n \"budget_cents\": 5000000,\n \"scopes\": [\n \"<string>\"\n ],\n \"allowed_categories\": [\n \"<string>\"\n ],\n \"token_ttl_seconds\": 2592000\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Site-ID", "<x-site-id>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/agent/consent/request")
.header("X-Site-ID", "<x-site-id>")
.header("Content-Type", "application/json")
.body("{\n \"agent_name\": \"<string>\",\n \"budget_cents\": 5000000,\n \"scopes\": [\n \"<string>\"\n ],\n \"allowed_categories\": [\n \"<string>\"\n ],\n \"token_ttl_seconds\": 2592000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/agent/consent/request")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Site-ID"] = '<x-site-id>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agent_name\": \"<string>\",\n \"budget_cents\": 5000000,\n \"scopes\": [\n \"<string>\"\n ],\n \"allowed_categories\": [\n \"<string>\"\n ],\n \"token_ttl_seconds\": 2592000\n}"
response = http.request(request)
puts response.read_body{
"device_code": "<string>",
"user_code": "<string>",
"verification_uri": "<string>",
"verification_uri_complete": "<string>",
"expires_in": 123,
"interval": 5
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Post Consent Request
Start a Device Authorization (RFC 8628) consent flow.
The agent calls this with the merchant identified by X-Site-ID
and the requested capability shape. Stella mints a fresh
consent-code row and returns:
device_code long opaque secret the agent uses on /poll
user_code short 8-char code the customer types
verification_uri where the customer goes to type it
verification_uri_complete same URL with ?user_code= baked in
expires_in seconds until both codes die
interval minimum seconds between polls
The decode-resistant user_code alphabet (no 0/O/1/I/L) is
chosen to minimise customer typing errors. Plaintexts are
returned exactly once and never leave this response.
curl --request POST \
--url https://api.example.com/api/agent/consent/request \
--header 'Content-Type: application/json' \
--header 'X-Site-ID: <x-site-id>' \
--data '
{
"agent_name": "<string>",
"budget_cents": 5000000,
"scopes": [
"<string>"
],
"allowed_categories": [
"<string>"
],
"token_ttl_seconds": 2592000
}
'import requests
url = "https://api.example.com/api/agent/consent/request"
payload = {
"agent_name": "<string>",
"budget_cents": 5000000,
"scopes": ["<string>"],
"allowed_categories": ["<string>"],
"token_ttl_seconds": 2592000
}
headers = {
"X-Site-ID": "<x-site-id>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Site-ID': '<x-site-id>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agent_name: '<string>',
budget_cents: 5000000,
scopes: ['<string>'],
allowed_categories: ['<string>'],
token_ttl_seconds: 2592000
})
};
fetch('https://api.example.com/api/agent/consent/request', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/agent/consent/request",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'agent_name' => '<string>',
'budget_cents' => 5000000,
'scopes' => [
'<string>'
],
'allowed_categories' => [
'<string>'
],
'token_ttl_seconds' => 2592000
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Site-ID: <x-site-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/agent/consent/request"
payload := strings.NewReader("{\n \"agent_name\": \"<string>\",\n \"budget_cents\": 5000000,\n \"scopes\": [\n \"<string>\"\n ],\n \"allowed_categories\": [\n \"<string>\"\n ],\n \"token_ttl_seconds\": 2592000\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Site-ID", "<x-site-id>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/agent/consent/request")
.header("X-Site-ID", "<x-site-id>")
.header("Content-Type", "application/json")
.body("{\n \"agent_name\": \"<string>\",\n \"budget_cents\": 5000000,\n \"scopes\": [\n \"<string>\"\n ],\n \"allowed_categories\": [\n \"<string>\"\n ],\n \"token_ttl_seconds\": 2592000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/agent/consent/request")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Site-ID"] = '<x-site-id>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agent_name\": \"<string>\",\n \"budget_cents\": 5000000,\n \"scopes\": [\n \"<string>\"\n ],\n \"allowed_categories\": [\n \"<string>\"\n ],\n \"token_ttl_seconds\": 2592000\n}"
response = http.request(request)
puts response.read_body{
"device_code": "<string>",
"user_code": "<string>",
"verification_uri": "<string>",
"verification_uri_complete": "<string>",
"expires_in": 123,
"interval": 5
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Headers
Body
Agent → Stella: start a consent flow.
The merchant is identified by the X-Site-ID header, NOT by a
body field — same convention as /api/storefront/*. Multi-merchant
agent tokens are out of scope for v1 (see PLAN §A2).
Free-form agent identity displayed on the consent screen. The customer's approval is what makes the string trustworthy; Stella does not register or authenticate agent identities in v1.
1 - 120Hard spending cap in merchant-currency minor units. Decremented at order creation. Refunds do NOT restore.
0 <= x <= 10000000Coarse capability vocabulary the agent is requesting. Phase 6 v1: catalog:read, cart:write, checkout:create, customer:read. Unknown scopes are rejected at validation time (422) so a customer is never asked to approve a permission Stella doesn't honor.
16Optional category allowlist. Empty = any category. Match is against Product.product_type / Product.tags case-insensitively.
32Requested lifetime for the minted agt_ token, in seconds. Min 1 minute, max 90 days. Default 30 days.
60 <= x <= 7776000Response
Successful Response
Stella → agent: device-flow handshake response per RFC 8628 §3.2.
verification_uri_complete includes the user_code so the agent
can render a single-tap link / QR code; verification_uri is the
bare endpoint for clients that prefer to display the user_code
separately.
Seconds until the codes expire.
Minimum seconds between poll calls per RFC 8628 §3.2. Reserved for future slow_down cadence enforcement; Phase 6-B currently uses a per-IP token bucket instead.