Open another sandbox with its code
const url = 'https://forge.example.com/api/demo/sandbox-code';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"code":"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://forge.example.com/api/demo/sandbox-code \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "code": "example" }'Takes a sandbox’s code, with or without its dashes, spaces and the word ANVIL, in either case. Answers a session for that sandbox’s visitor, as signing in does, with the refresh token cookie and the cookie that finds the sandbox again from this browser; the session the caller came with ends, and the sandbox they leave is deleted soon after when it holds no model and no draft and is open in no other browser. A code the demo does not know answers 400 naming code, and the code of the sandbox the caller is in answers 409. Too many tries from one address in a minute, or too many wrong codes, answer 429 with code: demo_rate_limited; a sandbox already open in as many browsers as it may be answers 429 with code: demo_quota. Answers 404 to anyone who is not a demo visitor.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
Example generated
{ "code": "example"}Responses
Section titled “Responses”OK
object
object
Example
{ "user": { "secondStepNeeded": false }}default
Section titled “default”A refusal or an error, as a problem document. A model or draft you may not see answers 404, as one that does not exist.
object
Example generated
{ "type": "example", "title": "example", "status": 1, "detail": "example", "instance": "example"}