Getting Started with Rekor

Rekor gives AI agents a persistent, structured place to store and query data — without migrations, infrastructure setup, or schema design upfront. Agents define their own schemas at runtime and start writing immediately.

Three Primitives

Everything in Rekor is built on three concepts:

PrimitiveWhat it is
CollectionA JSON Schema defining a record type. Created at runtime — no migrations.
RecordA JSON document conforming to a collection's schema. Upsert by external ID for idempotency.
RelationshipA typed, directed link between two records with optional metadata. Queryable in any direction.

5-Minute Tutorial

This walkthrough creates a workspace, defines a schema, writes records, links them with a relationship, and queries the result.

1. Install and authenticate

npm install -g @rekor/cli
rekor login

2. Create a workspace and preview environment

All schema changes happen in preview first, then get promoted to production.

rekor workspaces create crm --name "CRM"
rekor workspaces create-preview crm --name "setup"

3. Define collections in preview

rekor collections upsert contacts \
  --workspace crm--setup \
  --name "Contacts" \
  --schema '{
    "type": "object",
    "required": ["name"],
    "properties": {
      "name": { "type": "string" },
      "email": { "type": "string" },
      "company": { "type": "string" }
    }
  }'

rekor collections upsert deals \
  --workspace crm--setup \
  --name "Deals" \
  --schema '{
    "type": "object",
    "required": ["title", "value"],
    "properties": {
      "title": { "type": "string" },
      "value": { "type": "number" },
      "stage": { "type": "string" }
    }
  }'

4. Promote to production

rekor workspaces promote crm --from crm--setup --dry-run
rekor workspaces promote crm --from crm--setup

5. Write records

rekor records upsert contacts --workspace crm \
  --external-id "c_001" --source crm \
  --data '{"name": "Jane Doe", "email": "jane@acme.com", "company": "Acme"}'

rekor records upsert deals --workspace crm \
  --external-id "d_001" --source crm \
  --data '{"title": "Enterprise Plan", "value": 50000, "stage": "negotiation"}'

6. Link records with a relationship

rekor relationships upsert --workspace crm \
  --rel-type "owns" \
  --source-collection contacts --source-id c_001 \
  --target-collection deals --target-id d_001

7. Query and traverse

# SQL query
rekor sql "SELECT data.title.:String as deal, CAST(data.value, 'Float64') as value FROM records FINAL WHERE workspace_id = {workspace_id:String} AND collection = 'deals' AND CAST(data.value, 'Float64') >= 10000 AND deleted = false ORDER BY value DESC" --workspace crm

# Aggregate
rekor sql "SELECT sum(CAST(data.value, 'Float64')) as pipeline_total FROM records FINAL WHERE workspace_id = {workspace_id:String} AND collection = 'deals' AND deleted = false" --workspace crm

# Traverse relationships
rekor relationships query --workspace crm \
  --collection contacts --record-id c_001 \
  --rel-type owns --direction outgoing

Interfaces

Three ways to interact with Rekor — all backed by the same API.

MCP Tools

Eleven MCP tools that AI agents use to manage workspaces, collections, records, relationships, and more. An agent typically starts with manage_workspace(list) to discover context.

ToolDescription
batch_operationsExecute multiple record, relationship, and collection operations atomically. All operations succeed or all fail. Use for transactions, multi-entity writes, or any case where consistency between operations is required. Max 1,000 operations.
manage_attachmentManage file attachments on records. Filenames can include paths for folder structure (e.g. 'docs/guide.md', 'src/index.ts'). Upload returns a presigned URL — the agent uploads bytes directly.
manage_collectionManage collection schemas. Actions: upsert, get, list, delete. Use list to discover what collections exist in a workspace.
manage_hookManage inbound webhook endpoints. Hooks accept Record-format JSON and upsert through the normal write path.
manage_recordCreate, read, update, delete, or cancel individual records. Uses PUT for upsert. Supply external_id (and optional external_source) for idempotent writes from external systems — the internal UUID is auto-generated. Use record_id (internal UUID) for get/delete/cancel or to update a known record. Records may be archived (_archived: true in response) — archived records are read-only and cannot be upserted, but can be cancelled or deleted.
manage_relationshipCreate, read, update, or delete relationships between records. Relationships are typed, directed links with optional metadata.
manage_triggerManage outbound triggers. Triggers fire HTTP POST to a URL when records or relationships change.
manage_workspaceManage workspaces. Actions: create, get, list, delete, create_preview, list_previews. Start here to discover existing workspaces before operating. Note: schema changes (collections, triggers, hooks) can only be made in preview workspaces. Use create_preview to create a preview from a production workspace, then promote via CLI.
provider_adapterConvert between LLM provider tool formats (openai, anthropic, google, mcp) and Record collections. Actions: import_tools (create collections from tool definitions), export_tools (export collections as tool definitions), import_tool_call (create a record from a tool call in provider format).
query_relationshipsQuery relationships for a specific record. Find related records by type and direction.
sql_queryExecute a read-only SQL query against workspace data. Tables: records, relationships, collections, workspaces, operations_log. Always include workspace_id = {workspace_id:String} and deleted = false in WHERE. Use FINAL after table name.

CLI Commands

The Rekor CLI (@rekor/cli) provides a complete command-line interface.

npm install -g @rekor/cli
rekor login
CommandDescription
rekor attachmentsManage record attachments
rekor batchExecute atomic batch operations (up to 1,000 operations)
rekor collectionsManage collections
rekor endpointsManage MCP Factory endpoints
rekor hooksManage inbound webhook endpoints
rekor loginAuthenticate with Rekor
rekor logoutRemove stored authentication credentials
rekor providersImport/export tool definitions between LLM providers and Record collections
rekor query-relationshipsQuery related records
rekor recordsManage records
rekor relationshipsManage relationships between records
rekor sqlExecute a read-only SQL query against workspace data
rekor tokensManage API tokens
rekor triggersManage outbound triggers
rekor workspacesManage workspaces

REST API

All endpoints accept and return JSON. Base URL:

https://api.rekor.io/v1/{workspace_id}

Authenticate with a Bearer token in the Authorization header.

SectionDescription
WorkspacesWorkspaces API endpoints
CollectionsCollections API endpoints
RecordsRecords API endpoints
RelationshipsRelationships API endpoints
AttachmentsAttachments API endpoints
HooksHooks API endpoints
TriggersTriggers API endpoints
BatchBatch API endpoints
ProvidersProviders API endpoints
EnvironmentsEnvironments API endpoints

Integrations

Connect external systems, compose operations, and adapt to different AI providers.

Next Steps

  • Skill — load Rekor's skill into any AI agent so it can use the CLI as its data layer.
  • Environments — understand preview and production workspaces before deploying.
  • Query — SQL queries, cross-workspace queries, filter DSL, sorting, and aggregation.
  • Access Control — set up scoped API keys and organizations.
Overview — Rekor