Create or replace a helper library
const url = 'https://api.sloose.com/orgs/org_9f3c/libraries/acme';const options = { method: 'PUT', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"manifest":{"namespace":"example","version":"example","scope":"global","description":"example","functions":[{"name":"example","description":"example","params":[{"name":"example","type":"example","optional":true,"description":"example"}],"returns":"example","examples":[{"call":"example","result":"example"}],"tags":["example"]}]},"source":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://api.sloose.com/orgs/org_9f3c/libraries/acme \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "manifest": { "namespace": "example", "version": "example", "scope": "global", "description": "example", "functions": [ { "name": "example", "description": "example", "params": [ { "name": "example", "type": "example", "optional": true, "description": "example" } ], "returns": "example", "examples": [ { "call": "example", "result": "example" } ], "tags": [ "example" ] } ] }, "source": "example" }'The manifest is validated against the helper manifest contract, and its namespace must match the path. Only org-scoped libraries can be written here — a global library belongs to the product, not to an org.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The org id the session was issued for. A token for one org can never read another.
Example
org_9f3cThe org id the session was issued for. A token for one org can never read another.
The library namespace, as it appears in expressions.
Example
acmeThe library namespace, as it appears in expressions.
Request Bodyrequired
Section titled “Request Bodyrequired”object
object
object
object
object
The library’s ESM source, at most 256 KB.
Responses
Section titled “Responses”The stored library.
object
object
object
Only when asked for with ?source=1.
Example
{ "library": { "scope": "global" }}The request body did not match the schema. issues carries the Zod issue list.
The error envelope every non-2xx answer uses.
object
Human-readable explanation.
Machine-readable reason. Absent on a few legacy 400s.
Examplegenerated
{ "error": "example", "code": "example"}No bearer, or one that is expired, revoked or no longer resolves to a member.
The error envelope every non-2xx answer uses.
object
Human-readable explanation.
Machine-readable reason. Absent on a few legacy 400s.
Examplegenerated
{ "error": "example", "code": "example"}The bearer’s role is too low, or it was issued for a different org.
The error envelope every non-2xx answer uses.
object
Human-readable explanation.
Machine-readable reason. Absent on a few legacy 400s.
Examplegenerated
{ "error": "example", "code": "example"}The manifest’s namespace does not match the path, or it declares global scope.
object
Example
{ "code": "NAMESPACE_MISMATCH"}