Get a signed URL for a chat with history
const url = 'https://ai.work.optidata.cloud/api/ai/text/chat/contextual/signed';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"messages":[{"role":"user","content":"Reply with the single word OK."}]}'};
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://ai.work.optidata.cloud/api/ai/text/chat/contextual/signed \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "messages": [ { "role": "user", "content": "Reply with the single word OK." } ] }'Stores the conversation for one hour and returns a signed URL that
streams the assistant’s next answer when opened with GET, without an
authentication key. See GET /ai/text/chat/contextual.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
The conversation so far, oldest first. The last entry is answered.
object
Who wrote the message.
The message text.
Examples
{ "messages": [ { "role": "user", "content": "Reply with the single word OK." } ]}Responses
Section titled “ Responses ”A signed URL that streams the answer when opened with GET.
object
Open with GET, unchanged, within one hour.
Examples
{ "url": "https://ai.work.optidata.cloud/api/ai/text/chat?owt1=1&request_guid=a305082f-f339-4825-9a40-144077d1f9fa&signature=3f9a0c1e7b5d4a2f8e6c9b1d0a7f3e5c2b8d4a6f1e9c7b3d5a0f2e8c6b4d1a9f"}No authentication key was sent.
Authentication failures use an error key rather than message.
object
Examples
No bearer token sent
{ "error": "JWT passport exception: Missing bearer token in request"}The authentication key is expired or not recognised. Get a fresh one and retry.
Authentication failures use an error key rather than message.
object
Examples
{ "error": "JWT passport expired: Passport expired"}The request body failed validation.
object
The first validation message.
Validation messages keyed by field name.
object
Examplegenerated
{ "message": "example", "errors": { "additionalProperty": [ "example" ] }}