Origami

Quickstart

An API key, a workspace, a command and a file, step by step.

This takes about five minutes. You need curl, or Node.js 22 or later for the TypeScript version at the end.

1. Get an API key

  1. Sign in to the console at console.origamidb.xyz.
  2. Open API keys and choose New API key. Name it after the program that will use it.
  3. Copy the key. It begins with og_sk_ and is shown only once.

Only owners and administrators of an organization can create keys. If you're a member, ask one of them. Authentication says more about keys.

Keep the key in an environment variable:

Bash
export ORIGAMI_URL=https://api-next.origamidb.xyz
export ORIGAMI_API_KEY=og_sk_...

2. Create a workspace

Bash
curl -s -X POST "$ORIGAMI_URL/v1/workspaces" \
  -H "authorization: Bearer $ORIGAMI_API_KEY" \
  -H 'content-type: application/json' \
  -d '{"name":"quickstart"}'
JSON
{ "id": "ws_3f9c2a71d0b84e6a5c1d7e20", "name": "quickstart", "createdAt": "2026-11-24T18:02:11.204Z" }

Names are unique within your organization. Keep the id: every other call uses it.

Bash
export WS=ws_3f9c2a71d0b84e6a5c1d7e20

3. Run a command

Bash
curl -s -X POST "$ORIGAMI_URL/v1/workspaces/$WS/exec" \
  -H "authorization: Bearer $ORIGAMI_API_KEY" \
  -H 'content-type: application/json' \
  -d '{"command":"mkdir -p docs && echo \"# Hello\" > docs/readme.md && cd docs && ls -l"}'
JSON
{
  "stdout": "total 1\n-rw-r--r-- 1 user user     8 Nov 24 18:03 readme.md\n",
  "stderr": "",
  "exitCode": 0,
  "cwd": "/workspace/docs",
  "executor": "shell",
  "timedOut": false,
  "truncated": { "stdout": false, "stderr": false }
}

The workspace's files are under /workspace, and a command starts there. cwd says where the command ended. Pass it back to start the next command in the same place:

Bash
curl -s -X POST "$ORIGAMI_URL/v1/workspaces/$WS/exec" \
  -H "authorization: Bearer $ORIGAMI_API_KEY" \
  -H 'content-type: application/json' \
  -d '{"command":"cat readme.md","cwd":"/workspace/docs"}'

A command that fails still answers with HTTP 200. Look at exitCode and stderr.

4. Read the file directly

The files API reads and writes files without a command, which is the better way for large or binary files:

Bash
curl -s "$ORIGAMI_URL/v1/workspaces/$WS/files/content?path=docs/readme.md" \
  -H "authorization: Bearer $ORIGAMI_API_KEY"

Paths in the files API are relative to /workspace: docs/readme.md is what a command sees as /workspace/docs/readme.md.

5. Clean up

Bash
curl -s -X DELETE "$ORIGAMI_URL/v1/workspaces/$WS" \
  -H "authorization: Bearer $ORIGAMI_API_KEY"

The same in TypeScript

TypeScript
const base = process.env.ORIGAMI_URL ?? 'https://api-next.origamidb.xyz';
const headers = {
    authorization: `Bearer ${process.env.ORIGAMI_API_KEY}`,
    'content-type': 'application/json',
};

async function call<T>(method: string, path: string, body?: unknown): Promise<T> {
    const response = await fetch(`${base}${path}`, {
        method,
        headers,
        body: body === undefined ? undefined : JSON.stringify(body),
    });
    if (!response.ok) {
        // Every error is a problem document with a `code`.
        const problem = await response.json();
        throw new Error(`${problem.code}: ${problem.detail}`);
    }
    return response.status === 204 ? (undefined as T) : response.json();
}

type ExecResult = { stdout: string; stderr: string; exitCode: number; cwd: string };

const workspace = await call<{ id: string }>('POST', '/v1/workspaces', { name: 'quickstart' });
const run = (command: string, cwd?: string) =>
    call<ExecResult>('POST', `/v1/workspaces/${workspace.id}/exec`, { command, cwd });

let result = await run('mkdir -p docs && echo "# Hello" > docs/readme.md && cd docs');
result = await run('cat readme.md', result.cwd);
console.log(result.stdout); // # Hello

await call('DELETE', `/v1/workspaces/${workspace.id}`);

Next