canonical: https://jentic.com/apis/codehooks.io/codehooks

# Codehooks API

Jentic publishes the only available OpenAPI specification for Codehooks API, keeping it validated and agent-ready. Codehooks.io is a serverless backend-as-a-service that bundles a NoSQL document store, key-value store, queues, scheduled jobs, and serverless JavaScript or TypeScript functions behind a single API. The runtime API exposes 12 endpoints for collection CRUD, key-value operations, queue inserts, project info, and log streaming, all scoped to a project under a space-specific subdomain. Authentication is an x-apikey header issued per project, and the data API doubles as the storage layer for any Codehooks-deployed function.

## For AI agents

Read and write documents, key-value pairs, and queue items in a Codehooks.io serverless backend using an x-apikey header.

## Scope

Does not handle function deployment, billing, or user account management - use for runtime data, key-value, queue, and log operations on a Codehooks project only.

## Capabilities

- Create, query, replace, patch, and delete documents in any Codehooks collection via /{collection} endpoints
- Set, fetch, and delete arbitrary key-value pairs through `/kv/{key}`
- Enqueue background jobs by posting to `/queue/{name}`
- Stream recent application logs from a Codehooks project via GET /_log
- Resolve project and space metadata via GET /_info
- Run rich queries against collections by passing filter parameters to GET /{collection}
- Partially update existing documents using PATCH /{collection}/{id} without replacing the full record

## Use cases

### Lightweight Backend for an MVP

Use Codehooks as the entire backend for an MVP - collections store user and product data, the KV store holds feature flags, and queues coordinate background work. Front-end clients call /{collection} for CRUD without standing up a separate database, ORM, or hosting tier. Cuts time-to-first-user from weeks to a single afternoon.

Example prompt: Provision an 'orders' collection by POSTing a sample document to /orders, then read it back with GET /orders to confirm persistence

### Background Job Orchestration via Queues

Move long-running work - email sends, PDF generation, third-party syncs - into Codehooks queues so user-facing requests stay fast. The agent calls POST `/queue/{name}` to enqueue jobs, and a Codehooks function consumes them asynchronously. Replaces ad hoc setTimeout patterns and gives jobs visible retry semantics.

Example prompt: POST {to: 'alice@example.com', template: 'welcome'} to `/queue/email-send` and confirm the response includes the queued message id

### Configuration and Feature Flag Storage

Use the key-value store as a remote configuration and feature flag store for client apps. The agent writes flags via PUT `/kv/{key}` and clients read via GET `/kv/{key}` with a short cache. Avoids redeploying the front-end every time a flag flips while keeping the storage stack inside the same Codehooks project.

Example prompt: PUT {value: true} to `/kv/feature.checkout-v2` and verify GET `/kv/feature.checkout-v2` returns true

### Operational Log Inspection

Pull recent logs from a Codehooks project to debug a misbehaving function without leaving the agent loop. GET /_log returns the latest entries, which the agent can filter by severity and timestamp before posting a triage summary to the developer. Saves a context switch into the Codehooks dashboard.

Example prompt: Call GET /_log, filter to severity=error in the last 30 minutes, and summarise the top three error messages

### Agent-Driven Backend Operations via Jentic

An AI agent connected to Jentic can run end-to-end Codehooks workflows - read a document, enqueue a job, write a flag - in a single intent. Jentic stores the project x-apikey in its vault and resolves the space-specific base URL so the agent only specifies the operation. The raw API key never enters agent context.

Example prompt: Search Jentic for 'create Codehooks document', execute POST /{collection}=customers, then enqueue a follow-up via POST `/queue/onboarding-email`

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| GET | `/{collection}` | Query documents in a collection |
| POST | `/{collection}` | Create a document |
| PATCH | `/{collection}/{id}` | Partially update a document |
| DELETE | `/{collection}/{id}` | Delete a document |
| GET | `/kv/{key}` | Get a key-value pair |
| PUT | `/kv/{key}` | Set a key-value pair |
| POST | `/queue/{name}` | Enqueue an item |
| GET | `/_log` | Get application logs |

## Key resources

- **Collections** — Document CRUD over Codehooks NoSQL collections with filter, replace, and patch operations
- **Key-Value Store** — Get, set, and delete arbitrary keys for configuration and lightweight state
- **Queues** — Enqueue items for asynchronous processing by Codehooks functions
- **Project Info** — Read project and space metadata
- **Logs** — Stream recent application log entries

## Why Jentic

- **Setup:** Wiring Codehooks by hand means sending its x-apikey header, resolving the per-project host with its space, hash, and project segments, and handling collection, key-value, and queue calls yourself. Through Jentic you install once, import the Codehooks API from the API Directory, store the key once, and your agent calls it.
- **Permission scoping:** Codehooks puts the collection, key, and queue name in the URL path (/{collection}/{id}, `/kv/{key}`, `/queue/{name}`), so a rule can pin your agent to one collection or queue: it reads and writes that resource and nothing else. You choose the operations it may call, so destructive ones like deleting a document are not included unless you add them.
- **Credential handling:** Your Codehooks x-apikey value is stored once, encrypted, by your own Jentic One instance and injected at execution time as the x-apikey header. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'insert a Codehooks document' or 'enqueue a Codehooks job', and Jentic returns the matching operation with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **Supabase API** — Open source Postgres-backed BaaS with auth, storage, and edge functions
- **Appwrite Server API** — Self-hostable BaaS covering databases, auth, storage, and functions
- **Render API** — Hosts long-running services and cron jobs that Codehooks functions can call into

## FAQ

### Why is there no official OpenAPI spec for Codehooks API?

Codehooks.io does not publish an OpenAPI specification. Jentic generates and maintains this spec so that AI agents and developers can call Codehooks API via structured tooling. It is validated against the live API and kept up to date. Get started with Jentic One, the self-hosted execution layer.

### What authentication does the Codehooks API use?

The Codehooks API uses an API key in the x-apikey header. Generate the key inside the Codehooks CLI or dashboard and scope it per project. Through Jentic the key is stored in the vault and never enters agent context.

### Can I run queries against a Codehooks collection?

Yes. GET /{collection} accepts query parameters that filter documents by field equality, ranges, and pagination. The endpoint returns a JSON array, so an agent can iterate over results without hitting individual /{collection}/{id} endpoints.

### What are the rate limits for the Codehooks API?

Codehooks does not publish a fixed public rate limit; limits depend on the plan tier of the project. Treat the API as best-effort and back off on HTTP 429 responses. For high-throughput inserts, use queues so the runtime can absorb bursts.

### How do I enqueue a background job through Jentic?

Search Jentic for 'add item to Codehooks queue', load the POST `/queue/{name}` schema, and execute it with the queue name and payload. Jentic injects the x-apikey from the vault and returns the queued message id.

### Can I deploy serverless functions through this API?

No. Function deployment happens through the Codehooks CLI, not the runtime API. This spec covers the data plane - collections, key-value pairs, queues, project info, and logs. Functions you deploy via CLI then read and write through these same endpoints.

### Can I limit what my agent is allowed to do with the Codehooks API?

Yes. Because you run Jentic One yourself, your own rules decide which Codehooks operations and credentials the agent can use. Since Codehooks puts the collection, key, and queue name in the URL path (/{collection}/{id}, `/kv/{key}`, `/queue/{name}`), you can pin the agent to a single collection or queue so it reads and writes only that resource. You also pick the exact operations it may call, so a destructive one like DELETE /{collection}/{id} is available only if you add it.
