Set a vault key
const url = 'http://127.0.0.1:7700/api/vault/FACTORY_API_KEY';const options = { method: 'PUT', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"value":"example-key-value"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url http://127.0.0.1:7700/api/vault/FACTORY_API_KEY \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "value": "example-key-value" }'Owner only. Sets or replaces one key in /etc/box/vault.env, which stays readable by root only. The
value is one line of up to 8192 characters. The log records that the name was set, never the value.
No route reads a value back. The box uses the new value straight away.
An ANTHROPIC_API_KEY is tried first with a free call to Anthropic. A key Anthropic rejects is a
400 and is not saved. If Anthropic cannot be reached, the key is saved and check says unchecked.
A FACTORY_API_KEY is saved unchecked.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Capital letters, digits and _, 2 to 64 characters, starting with a letter.
Example
FACTORY_API_KEYRequest Bodyrequired
Section titled “Request Bodyrequired”object
The key. Never shown again.
Example
{ "value": "example-key-value"}Responses
Section titled “Responses”The name and when it was set.
object
For a model key
For a model key
For a model key
Example
{ "check": "ok"}A bad name or value, or a model key the provider rejected. The message never repeats the value.
object
What went wrong
Example generated
{ "error": "example"}The owner’s route, called by someone who is not the box’s own screen or a device paired as the owner.
object
What went wrong
Example
{ "error": "only this computer's own screen or the owner's paired device can do this"}