curl --request GET \
--url https://app.sapientpriors.com/api/v1/session \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.sapientpriors.com/api/v1/session"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.sapientpriors.com/api/v1/session', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"authenticated": true,
"user": {
"id": "<string>",
"email": "jsmith@example.com",
"display_name": "<string>"
},
"organization_id": "<string>",
"organization_name": "<string>",
"max_upload_bytes": 2,
"max_image_bytes": 2,
"max_images_per_turn": 2,
"max_image_bytes_per_turn": 2
}{
"error": "<string>",
"code": "<string>",
"request_id": "<string>",
"details": "<string>"
}{
"error": "<string>",
"code": "<string>",
"request_id": "<string>",
"details": "<string>"
}Read your key's identity and upload limits
Confirms which organization your key resolves to, and returns the upload limits your organization is held to. Call it once when your client starts, and check a file against the max_* values before you send it.
curl --request GET \
--url https://app.sapientpriors.com/api/v1/session \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.sapientpriors.com/api/v1/session"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.sapientpriors.com/api/v1/session', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"authenticated": true,
"user": {
"id": "<string>",
"email": "jsmith@example.com",
"display_name": "<string>"
},
"organization_id": "<string>",
"organization_name": "<string>",
"max_upload_bytes": 2,
"max_image_bytes": 2,
"max_images_per_turn": 2,
"max_image_bytes_per_turn": 2
}{
"error": "<string>",
"code": "<string>",
"request_id": "<string>",
"details": "<string>"
}{
"error": "<string>",
"code": "<string>",
"request_id": "<string>",
"details": "<string>"
}Authorizations
Your API key, shaped sp_<key_id>_<secret>, sent as Authorization: Bearer sp_.... It identifies your organization, not a person. Your organization owns the agents, holds the credit, and is billed. Every key your organization holds reaches the same things, so you rotate a key by minting the new one, deploying it, and revoking the old one.
Keep the key on your server. A request that carries a Sec-Fetch-Site header is refused with 400, because only a browser sets that header. Priors sends no CORS headers, so a browser blocks the call before it leaves the page. The secret is shown once when the key is minted and is stored only as a hash. A lost secret is replaced, never recovered.
An administrator of your organization mints and revokes keys in the Priors application, under Settings. There is no endpoint for it: a key reaches your whole organization, so issuing one is an act of administration.
Response
Authenticated application session.
What your key resolves to, and the upload limits that apply to it. Read it once when your client starts rather than hardcoding the numbers.
true The principal this request ran as. Without X-SP-End-User that is your organization; with it, the derived id for that person. email is empty and display_name reads partner key, because a key names no person.
Show child attributes
Show child attributes
The largest document your organization may upload, in bytes. A larger upload is refused with 413 before any conversion.
x >= 1The largest single image, in bytes. Refused with 413 while the body streams.
x >= 1How many distinct image sources one chat turn may name. A turn naming more is refused rather than truncated.
x >= 1The total bytes of image one chat turn may carry, across every attachment. Not implied by the two limits above: this is the cap their product would otherwise reach. Always >= max_image_bytes, so a single image at the per-image limit is always sendable. A turn over it is refused with 413 and code payload_too_large.
x >= 1