OpenThink Cloud

Quickstart: deploy a route

Write a service with one route, deploy it, and call it over HTTP.

Before you begin

  • An OpenThink account and a project (space) you own, or in which you have the Write Function permission.
  • A table in that project. This guide uses a table named Tasks with the columns Title, Status and Assignee.

Write the service

The first // … comment is the service name. The module must export default a Service.

service.js
// Kanban
import { Service, HTTPError } from "think"

const app = new Service()
app.owns("Tasks")

app.post("/tasks/:id/complete", { name: "task:complete", description: "Mark a task as done" }, async (c) => {
  const { viewer, store } = c.var.think
  const task = await store.get("Tasks", c.req.param("id"))
  if (!task) return c.json({ error: "task not found" }, 404)
  if (task.Assignee !== viewer.email) throw new HTTPError(403, "not the assignee")
  await store.update("Tasks", task._id, { Status: "Done" })
  return c.json({ ok: true })
})

export default app

Deploy it

Deploy with the build tool over MCP (for example from Claude), passing the code as service.code. The result contains the deployed version and its URL.

json
{ "space": "Kanban", "service": { "code": "<contents of service.js>" } }

Call it

Call the route with a project API key or a personal access token in the Authorization header.

bash
curl -X POST https://openthink.app/api/svc/<project>/tasks/<row-id>/complete \
  -H "Authorization: Bearer thk_..."

Every response carries an x-think-request-id header. Use it to find the call in the logs.

Next steps

Last updated 2026-12-03 UTC. Something wrong or missing? Send feedback.