Allow an AI client into the workspace with the scopes you choose among those offered: a viewer's reads alone. Answers where to send the browser, with the code
POST
/v1/buyer/ai-clients/authorize
const url = 'https://example.com/v1/buyer/ai-clients/authorize';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"client_id":"example","code_challenge":"example","code_challenge_method":"example","redirect_uri":"example","resource":"example","response_type":"example","scope":"example","scopes":["example"],"state":"example"}'};
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/v1/buyer/ai-clients/authorize \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "client_id": "example", "code_challenge": "example", "code_challenge_method": "example", "redirect_uri": "example", "resource": "example", "response_type": "example", "scope": "example", "scopes": [ "example" ], "state": "example" }'Who: a workspace’s buyer or viewer. Not for API keys.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
client_id
required
string
code_challenge
required
string
code_challenge_method
required
string
redirect_uri
required
string
resource
required
string
response_type
required
string
scope
required
string
scopes
Array<string>
state
required
string
Example generated
{ "client_id": "example", "code_challenge": "example", "code_challenge_method": "example", "redirect_uri": "example", "resource": "example", "response_type": "example", "scope": "example", "scopes": [ "example" ], "state": "example"}Responses
Section titled “Responses”OK
Media typeapplication/json
object
redirect
required
string
Example generated
{ "redirect": "example"}default
Section titled “default”An error, as go-commons apperr maps it
Media typeapplication/json
object
error
required
object
code
required
string
fields
object
key
additional properties
string
message
required
string
Example generated
{ "error": { "code": "example", "fields": { "additionalProperty": "example" }, "message": "example" }}