SDKs TypeScript SDK
TypeScript SDK
The planned TypeScript SDK for the Syntext API — not released yet.
A TypeScript SDK, @syntext/sdk, is planned but not released yet — npm install @syntext/sdk doesn't work today.
Until it ships, call the REST API with fetch:
typescript
const res = await fetch(`https://api.syntext.dev/v1/projects/${projectId}/builds`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.SYNTEXT_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ branch: 'main' }),
})
const body = await res.json()
if (!res.ok) throw new Error(`${body.error.code}: ${body.error.message}`)
console.log(body.data.id)
Project API keys work on the build, deploy and content endpoints; everything else takes a session token — see Authentication. Errors always have the shape in Errors.
Note
To deploy docs from CI, use the stx CLI rather than the API directly — it uploads your files and waits for the build.
Was this page helpful? Yes No
Previous