Skip to main content

Schema-per-tenant APIs

There is no static API reference for Twenty. Each workspace has its own schema — when you add a custom object (say Invoice), it immediately gets REST and GraphQL endpoints identical to built-in objects like Company or Person. The API is generated from the schema, so endpoints use your object and field names directly — no opaque IDs. Your workspace-specific API reference lives in the API playground (see below). It reflects your custom objects and fields and lets you execute real calls against your data. API access is included on every plan, Cloud and self-hosted.

Two APIs

Core API — /rest/ and /graphql/ CRUD on records: People, Companies, Opportunities, your custom objects. Query, filter, traverse relations. Metadata API — /rest/metadata/ and /metadata/ Schema management: create/modify/delete objects, fields, and relations. This is how you programmatically change your data model — for example, to create a large number of custom fields during a migration instead of adding them by hand. See Create fields with the Metadata API. Both are available as REST and GraphQL. Same underlying data either way; GraphQL lets you traverse relations and pick nested fields in a single query.

Base URLs

Before you start: who can see the Developers settings

Settings → Developers is only visible to members whose role has the Developers permission (“Manage API keys, webhooks, and apps”). Admins have it by default; the default Member role does not. If you don’t see Developers in your settings sidebar, it’s a permission issue, not a plan issue. Ask a workspace admin to either:
  • create the API key for you, or
  • give you a role with the Developers permission under Settings → Members → Roles (see Permissions).

Authentication

For OAuth-based access (external apps acting on behalf of users), see OAuth.

Create an API key

  1. Go to Settings → Developers. The API tab is open by default.
  2. Under API Keys, click Create API key.
  3. Fill in:
    • Name — a descriptive name, e.g. “Salesforce migration”.
    • Role — the role whose permissions the key will use. Required. Only roles marked as assignable to API keys are listed.
    • Expiration Date — when the key stops working.
  4. Save, then copy the key immediately — it’s shown only once.
An API key grants access to your workspace data with its role’s permissions. Keep it out of version control and shared files. If a key leaks, regenerate or delete it right away.

Pick the right role for the key

An API key can do exactly what its role allows — nothing more. In particular:
  • Reading and writing records (Core API) requires object permissions on the objects you touch.
  • Creating or editing objects and fields (Metadata API) requires the Data model settings permission. A key whose role lacks it gets a permission error on /rest/metadata/ and /metadata/ write calls.
The built-in Admin role covers both. On Twenty Cloud, creating custom roles for API keys requires the Organization plan; see Permissions.

Manage API keys

Open Settings → Developers → API and click a key to:
  • Change its role or rename it.
  • Regenerate it — the old key stops working immediately and the new one is shown once.
  • Delete it.
You can also see which keys use a role from Settings → Members → Roles → role → Assignment.

API playground

  1. Go to Settings → Developers → API.
  2. Under Documentation, pick a Schema (Core for records, Metadata for objects and fields) and an API (REST or GraphQL).
  3. Click Launch.
You don’t need to create an API key to use the playground — it signs requests with a short-lived token for your current session. Calls you make there run against your real data with your own permissions.

Create fields with the Metadata API

Example: add a text field to the company object over REST. 1. Find the object’s ID.
Look for the object whose nameSingular is company and note its id. 2. Create the field.
For a select field, pass "type": "SELECT" (or MULTI_SELECT) and an options array:
The GraphQL equivalent is the createOneField(input: { field: { ... } }) mutation on /metadata. Rules that trip up scripted migrations:
  • name must start with a lowercase letter and contain only letters and digits (camelCase, e.g. annualRevenue2024). It must be unique on the object and not a reserved word.
  • Select option values must be UPPER_SNAKE_CASE.
  • Fields are created one per request. Creating 150 fields is 150 calls — well within the rate limit if you send them sequentially.
  • Common type values: TEXT, NUMBER, BOOLEAN, DATE, DATE_TIME, SELECT, MULTI_SELECT, CURRENCY, LINKS, EMAILS, PHONES, ADDRESS, RATING, RICH_TEXT, RELATION.
Open the Metadata schema in the playground to see every available field type and its options.

Batch operations

Batch create and upsert accept up to 200 records per request. Update and delete many apply to all records matching the filter.

Selecting fields (REST)

REST record endpoints accept a fields query parameter to return only the fields you need:
  • id is always returned.
  • Composite fields (like emails or name) are selected as a whole by their field name.
  • A many-to-one relation field returns its join column (e.g. companyId) with depth=0. One-to-many relation fields are only returned with depth=1. With depth=1, only the relation fields listed in fields are expanded.
  • Unknown fields, or fields your role cannot read, return a 400 error.
When fields is omitted on an object with more than 200 readable fields, each record returns a default set of 200 fields: id, the label and image identifier fields, createdAt, updatedAt, deletedAt, position, then standard fields before custom fields, ordered by name. Pass fields explicitly to read any field beyond that default set.

Pagination

List endpoints return 60 records per page by default. Pass limit to change it, up to a maximum of 200. To fetch the next page over REST, pass the endCursor from the response’s pageInfo as starting_after (or startCursor as ending_before to go back). GraphQL uses the standard first/after connection arguments.

Rate limits

When you exceed the rate limit, the API returns 429 Too Many Requests. Back off and retry. Self-hosted instances can change the request limits with the API_RATE_LIMITING_* environment variables.