Create Scope
const url = 'https://agents.lumalabs.ai/v1/scopes';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"config":{},"display_name":"example","expires_in_seconds":1,"key":"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://agents.lumalabs.ai/v1/scopes \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "config": {}, "display_name": "example", "expires_in_seconds": 1, "key": "example" }'Create a scope (workspace) or retrieve an existing one by key.
Supplying key makes creation idempotent, however many requests race:
a new key is 201, and a repeat that omits config or names the same one
is 200 with replayed: true and the original scope. A repeat with a
different config is 409 SCOPE.IDEMPOTENCY_CONFLICT. A key another team holds
is 409 SCOPE.KEY_TAKEN, never a retrieval.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
Examplegenerated
{ "config": {}, "display_name": "example", "expires_in_seconds": 1, "key": "example"}Responses
Section titled “ Responses ”An existing scope, replayed by key.
object
True when a create re-posted an existing key and this is the scope that key already names.
UUID identifying this scope. Pass as scope_id when creating sessions.
Example
{ "replayed": false}Successful Response
object
True when a create re-posted an existing key and this is the scope that key already names.
UUID identifying this scope. Pass as scope_id when creating sessions.
Example
{ "replayed": false}Validation Error
object
object
object
Examplegenerated
{ "detail": [ { "ctx": {}, "input": "example", "loc": [ "example" ], "msg": "example", "type": "example" } ]}