Skip to Content
API ReferenceGraphQL API

GraphQL API

The Foir GraphQL API is the primary interface for querying content, managing records, executing operations, searching, and authenticating users. Your project’s GraphQL schema is generated from your models, so every model you define becomes directly queryable.

Schema Generation

When you create models in the Foir dashboard, the GraphQL schema is automatically generated for your project. Each model produces:

  • A singular query (e.g., page, product) that returns a single typed record
  • A plural query (e.g., pages, products) that returns a cursor-paginated connection
  • Create, update, delete, and (for versioned/publishable models) publish and unpublish mutations
  • Typed input types matching your model’s fields, including where, orderBy, and update-operator inputs

Each generated record type exposes your declared fields directly at the top level alongside a set of underscore-prefixed system fields — _id, _naturalKey, _modelKey, _createdAt, _updatedAt, _hasDraft, _ownerId, _ownerKind, _variant, _segments and _resolvedBy. There is no data wrapper.

You can explore your generated schema using the GraphiQL explorer at https://api.foir.dev/graphiql or by fetching the schema from GET https://api.foir.dev/schema.

Every query and mutation is generated per model from your schema. Each model gets its own typed fields (e.g. page, pages, createPage), and system fields are _-prefixed (_id). These typed per-model fields are the recommended interface — use them. A generic record(id:) / records(modelKey:) pair also exists as a raw-JSON escape hatch (gated on records:read), but there is no generic recordByKey or createRecord: fetch-by-natural-key and writes go through the typed per-model fields.

Request Headers

Every request accepts these headers. Authentication is required; the others are optional opt-ins.

HeaderPurpose
Content-Type: application/jsonRequired — all requests are JSON.
x-api-key: <key>API-key authentication. Your app sends its publishable key (foir_pub_…), or its server key (foir_srv_…) from the server that renders its pages, with the user’s bearer below when someone is signed in; an admin key (foir_adm_…) is for a machine of your own. See Authentication.
Authorization: Bearer <token>Two different credentials share this header: a console session token (the console and the CLI) and a signed-in user’s token (storefront traffic). Which one a request is read as depends on whether it also carries x-api-key. See below.
X-Foir-Schema-Channel: draftRead the draft schema and content instead of published. Requires a key holding the drafts:read scope, which is a preview environment’s own key; a publishable or a server key without the scope is served published, and an admin key without it is refused. See Schema Publishing.

To personalise reads (variants, segments), pass the contexts query argument — there is no context request header.

The Bearer header carries two lanes

Authorization: Bearer is not only the console session header. A signed-in user’s token travels on it too, and storefront traffic uses it routinely — a page that reads a user’s own orders is sending one.

The server reads x-api-key first. When the request carries a key, the key authenticates it, and a bearer beside it is verified as a signed-in user of that key’s project. Only a request with no key is served on its bearer alone, which is how the console and the CLI call.

Two consequences worth knowing before you debug one of them:

  • A console token sent beside a key is read as a user token of the key’s project. It belongs to no user there, so the request is served as nobody signed in, and extensions.auth says why. If you are sending both and seeing key-shaped results where you expected console-shaped ones, drop the key.
  • The two lanes resolve to different principals, so the same document can return different rows depending on which token you sent — the console session’s authority against a user’s own-rows view. When a response surprises you, check which lane authenticated before looking at the query.

Responses that hit a rate limit include X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, and (on 429) Retry-After — see Errors & Rate Limits.

Persisted Queries

A document can be sent as a hash instead of its text. Foir speaks automatic persisted queries in the shape every GraphQL client already uses, so most clients need a flag rather than an integration.

Send the SHA-256 of the document text, hex encoded, in extensions:

{ "variables": { "slug": "homepage" }, "extensions": { "persistedQuery": { "version": 1, "sha256Hash": "b1946ac9…" } } }

If the server has seen that document before, it answers normally. If it has not, it answers HTTP 200 with an errors array:

{ "errors": [{ "message": "PersistedQueryNotFound", "extensions": { "code": "PERSISTED_QUERY_NOT_FOUND" } }] }

Retry with both the query and the extensions. That registers the document and returns the answer in the same round trip, and every later request for it can send the hash alone. Note the status: a miss is a 200, not a 404, so branch on extensions.code rather than on the status.

The full document always remains executable. Nothing is allow-listed, so GraphiQL, curl and every hand-written client work unchanged whether or not they ever send a hash.

Two reasons to use it:

  • A hash fits in a URL where a document does not. The shared read endpoint is a GET, and a complete selection over a model with a block union runs to thousands of characters — past what a proxy will accept. Its hash is always 64.
  • Smaller requests. The document travels once per deployment rather than once per request.

Always retry with a POST rather than a longer GET, which is the limit the hash exists to stay under.

@foir/sdk/data does all of this for you: it hashes the document it printed, sends the hash first on both the shared and the ordinary path, and falls back to the document on a miss.

A caller that starts cold, such as a Worker or a serverless function, builds a new client every time. Hash first, its first call of a document the server has not seen is two requests. Pass persistedQueries: 'document-first' and each document goes with its hash the first time a client uses it, so the server registers and answers it in one request, and only the hash after that. That first send is a POST, so a read it answers is not one the shared cache stores:

const foir = createFoirClient({ apiUrl, apiKey, generated, persistedQueries: 'document-first' });

Querying Records

Every public model gets a typed singular query (named after the model, e.g. page) and a typed plural query (the model’s plural, e.g. pages). Both return the model’s typed object: your declared fields are merged at the top level, alongside the underscore-prefixed system fields. There is no data or metadata wrapper.

Single Record

Fetch a single record by natural key (slug or handle) or by ID:

query GetPage { page(naturalKey: "homepage") { _id _naturalKey _createdAt _updatedAt title heroImage { url alt } } }

The same read through the data client, which addresses the operation (findUnique) rather than the root field (page):

const page = await foir.page.findUnique({ naturalKey: 'homepage' });

Every scalar comes back whether you name it or not, image and file values included. Only relations to other records are opt-in, through include.

query GetPageById { page(id: "rec_abc123") { _id title } }
const page = await foir.page.findUnique({ id: 'rec_abc123' });

You must supply either naturalKey or id. The query returns null when no record matches — the data client’s return type says so too.

List Records

The plural query returns a Relay-style cursor connection. Use where to filter, orderBy to sort, and first/after (or last/before) to paginate:

query ListProducts { products( where: { category: { eq: "electronics" }, price: { gte: 100 } } orderBy: [{ createdAt: DESC }] first: 10 ) { edges { node { _id _naturalKey title price } cursor } pageInfo { hasNextPage hasPreviousPage startCursor endCursor } totalCount } }

The same list through the data client:

const products = await foir.product.findMany({ first: 10, where: { category: { eq: 'electronics' }, price: { gte: 100 } }, orderBy: [{ createdAt: 'DESC' }], }); for (const { node } of products.edges) render(node);

findMany returns the same Relay connection — edges, pageInfo, totalCount — so pagination works identically. The difference is the node: it carries every scalar on the model, not the four selected above. Use omit to drop the expensive ones and include to pull in a relation.

To fetch the next page, pass the previous page’s pageInfo.endCursor as after.

Query Arguments

Single-record query (<model>):

ArgumentTypeDescription
naturalKeyStringNatural key / slug
idStringRecord ID
localeStringLocale for content resolution (e.g., "en-US", "fr-FR")
previewBooleanReturn draft content instead of published (requires the drafts:read scope)
contextsResolveContextInputContext dimensions for variant resolution

List query (<models>):

ArgumentTypeDescription
where<Model>WhereInputTyped filter tree (see Filtering)
orderBy[<Model>OrderByInput]Sort order (see Sorting)
firstIntForward page size
afterStringOpaque cursor — fetch rows after this position
lastIntBackward page size
beforeStringOpaque cursor — fetch rows before this position
localeStringLocale for content resolution
previewBooleanReturn draft content instead of published
contextsResolveContextInputContext dimensions for variant resolution

Content Resolution

Content resolution — variant selection, locale handling, and reference resolution — happens automatically based on the query arguments. There is no separate resolved sub-field: the resolved values are returned directly on the typed fields.

  • locale selects the localized value for translatable fields.
  • contexts drives variant matching (see Context).
  • preview: true returns the latest draft instead of the published version. This requires a key holding the drafts:read scope, a preview environment’s own key; on a key without it the flag is rejected.
  • Reference fields resolve to the typed target record, so you project the referenced record’s fields inline (e.g. author { _id name }). Polymorphic references resolve to a union — use inline fragments (... on Author { name }).

System Fields

Every typed record exposes these underscore-prefixed system fields. They never collide with your declared fields:

FieldTypeDescription
_idString!Unique record identifier
_naturalKeyStringSlug or handle
_modelKeyString!Model this record belongs to
_createdAtDateTime!When the record was created
_updatedAtDateTime!When the record was last modified
_hasDraftBooleanWhether unpublished changes exist. Populated only for keys holding drafts:read; otherwise null.
_ownerIdStringThe record’s owner, on an owned-plane model. null where the record has no owner.
_ownerKindStringWhat owns the record: user or organization.
_variantStringThe human key of the variant this read resolved onto (default, or one of your variant keys). null on a model with no variants, and on the fallback path.
_segmentsJSONThe caller’s segment membership vector. Requires targeting:debug.
_resolvedByStringWhy this variant was chosen. Requires targeting:debug.

_segments and _resolvedBy come back null for a caller without targeting:debug, the same treatment _hasDraft gets without drafts:read. That is deliberate: the two describe your segmentation rules and the decision one request made against them, so the server never fills them in for a caller who may not see that.

Models with embeddings enabled get two more, which take a slot key and resolve to null without embeddings:read:

FieldTypeDescription
_hasEmbedding(key: String)BooleanWhether this record has a stored embedding for the slot. Omit key for any slot.
_embeddingContentHash(key: String)StringThe content hash stored with that embedding; null when there is none.

Your declared model fields are queried directly by their own keys at the top level of the object.

Version History

For versioned or publishable models, browse version history with recordVersions. It returns a cursor connection of RecordVersion:

No SDK equivalent — a version row carries its record’s data as an untyped JSON blob under a model named at runtime, so nothing generated from a per-model manifest can type what comes back. The typed per-model operations are the data client’s whole point; an untyped door beside them would be a downgrade, not parity. Read history through /graphql.

query GetVersions { recordVersions(parentId: "rec_abc123", first: 10) { edges { node { id versionNumber changeDescription data createdAt } } pageInfo { hasNextPage endCursor } totalCount } }

Required scope: records:read

Filtering

Each model has a generated <Model>WhereInput, a typed operator tree. Top-level fields are combined with AND. Filter on declared fields by key, plus the always-available direct columns: id, naturalKey, createdAt, updatedAt, ownerId, ownerKind, createdBy, updatedBy. ownerId matches the owner whatever kind it is (a user or an organization), and ownerKind names the kind (user or organization). A direct column wins over a declared field of the same name, so a model field keyed ownerKind is not filterable.

query FilteredProducts { products( where: { category: { eq: "electronics" } price: { gte: 100 } inStock: { eq: true } } orderBy: [{ createdAt: DESC }] ) { edges { node { _id _naturalKey title } } totalCount } }

The where tree is the same tree on the data client, passed as the where argument:

const products = await foir.product.findMany({ where: { category: { eq: 'electronics' }, price: { gte: 100 }, inStock: { eq: true }, }, orderBy: [{ createdAt: 'DESC' }], });

Operators by field type

Operators available on a field depend on its type:

Field typeOperators
Texteq, ne, in, nin, lt, gt, lte, gte, contains, startsWith, endsWith, like, ilike, isNull, isNotNull
Numbereq, ne, in, nin, lt, gt, lte, gte, isNull, isNotNull
Dateeq, ne, in, nin, lt, gt, lte, gte, isNull, isNotNull
Booleaneq, ne, isNull, isNotNull
ID (id, ownerId, …)eq, ne, in, nin, isNull, isNotNull
Select / Enumeq, ne, in, nin, isNull, isNotNull (values are the field’s typed options)

Combining Conditions

Use AND, OR, and NOT to compose conditions at any level:

query { products( where: { OR: [ { category: { eq: "electronics" } } { category: { eq: "computers" } } ] NOT: { status: { eq: "archived" } } } ) { edges { node { _id title } } } }
const products = await foir.product.findMany({ where: { OR: [{ category: { eq: 'electronics' } }, { category: { eq: 'computers' } }], NOT: { status: { eq: 'archived' } }, }, });

List and Reference Fields

  • List fields accept { some, every, none }, each taking the item’s where shape — e.g. tags: { some: { eq: "featured" } }.
  • Reference fields accept the referenced model’s where shape directly — e.g. author: { naturalKey: { eq: "jane-doe" } }. Polymorphic references use one on<Model> branch per allowed target.

Sorting

Sort the plural query with orderBy, a list of <Model>OrderByInput. Each entry sets one field to ASC or DESC. Orderable direct columns are createdAt, updatedAt, naturalKey, and id; orderable scalar fields you declared can also be used.

query { products(orderBy: [{ createdAt: DESC }, { id: ASC }]) { edges { node { _id title } } } }
const products = await foir.product.findMany({ orderBy: [{ createdAt: 'DESC' }, { id: 'ASC' }], });

Context

Context lets you deliver personalized content based on dimensions like device, locale, or custom attributes. Pass contexts (a ResolveContextInput) to any per-model query to trigger variant matching; the resolved values come back directly on the typed fields.

query PersonalizedContent { page( naturalKey: "homepage" locale: "en-US" contexts: { device: MOBILE, platform: IOS } ) { _id title hero { heading } } }

The same personalised read through the data client:

const page = await foir.page.findUnique({ naturalKey: 'homepage', locale: 'en-US', contexts: { device: 'MOBILE', platform: 'IOS' }, });

Note: variant resolution is driven by the contexts argument, and the data client spells it the same way because it is the same argument — a ResolveContextInput object. A list of strings is rejected with Expected "ResolveContextInput", found not an object.

Built-in Context Dimensions

DimensionTypeExample Values
localeString"en-US", "fr-FR"
deviceDeviceType enumDESKTOP, MOBILE, TABLET
platformPlatformType enumWEB, IOS, ANDROID

Custom Dimensions

You can define custom context dimensions in your project settings (e.g. market, userSegment, channel). Each appears as a field on ResolveContextInput, typed as an enum of its configured values when you have defined them. A value is its own enum value (market: us), with any character a GraphQL name cannot hold, such as the hyphen in en-gb, served as an underscore (en_gb). User-derived dimensions such as authentication status and segment membership are filled in server-side from the user token and are not client inputs.

Mutations

Every public model gets create<Model>, rename<Model>, delete<Model>, duplicate<Model> and refresh<Model>, and update<Model> and updateMany<Model> when it has a field an update can change. The rest depend on what the model declares, and the conditions are not the ones you would guess from the names:

MutationGenerated when the model has
revert<Model>ToVersionversioning or publishing or variants — any of the three keeps history worth rewinding
publish<Model>Version, unpublish<Model>publishing or variants
setMy<Model>a user-owned singleton. The signed-in user upserts their own one record

Variants are the reason these read oddly. A model with variants but no explicit publishing flag still has something to publish and something to revert, so it gets the whole set.

The record writes (create<Model>, update<Model>, rename<Model>) return <Model>WritePayload: the record as the write left it, under record, and replayed. The other mutations return the typed record, a payload or Boolean, as noted. <model>Aggregate is a query, not a mutation.

Create a Record

create<Model>(input: Create<Model>Input!, idempotencyKey: String) takes the model’s declared fields flattened at the top level, plus one optional system key: naturalKey. It returns <Model>WritePayload, the created record under record beside replayed. Record-level system metadata (versioning and publishing state) is platform-owned and not writable through the API.

mutation CreatePage { createPage(input: { naturalKey: "about" title: "About Us" body: "Welcome to our company..." }) { record { _id _naturalKey _createdAt title } replayed } }

The same write through the data client:

const { record: page } = await foir.page.create({ input: { naturalKey: 'about', title: 'About Us', body: 'Welcome to our company...', }, });

idempotencyKey makes the create safe to retry. Send the same key again and the platform answers with the record the first attempt made, instead of making a second one, and replayed is true. The data client generates a key for every create it sends, so a create through foir.<model>.create is retry-safe without you passing one. A visitor’s create is remembered the same way. Every visitor presents the same publishable key, so the key has to be one no other visitor would send, which a random one is; the same key with a different request is refused.

Note: a write takes the same arguments its GraphQL field takes: the generated argument types are the field’s own arguments, so input, where and the data operator tree are written exactly as they are above. What changes is the response: it comes back with every scalar on the record, not the fields selected here. See Selection & Responses.

A create needs no read, and answers accordingly. A caller that may create records of this model and may not read them is answered with the new record’s _id and nothing else. Asking for any other field is refused before the record is made, naming records:read:<model>. Ask for record { _id }, or with the data client pass pick: ['_id']. A caller that reads the model asks for what it likes. See Changing a record takes reading it.

naturalKey on a create is a request, not a reservation. If another record already holds the key you asked for, the create still succeeds — the platform appends a numeric suffix and stores about-1, then about-2, and reports success. It never returns ALREADY_EXISTS for this.

So the key you sent is not necessarily the key you got. Select _naturalKey on every create whose key you intend to address the record by later, and use what comes back. Renaming a record onto a key another record holds is refused, with ALREADY_EXISTS; only the create path suffixes.

Required scope: records:create (a holder of records:write holds it too)

Update a Record

update<Model>(where: <Model>WhereInput!, data: <Model>UpdateInput!, idempotencyKey: String) identifies the target with where (which must match exactly one record) and applies a typed operator tree in data. For versioned models, the update creates a new version automatically.

Rather than flat values, each field in <Model>UpdateInput takes an operator object:

  • Scalars (text/date/select/enum/boolean): { set } or { setNull: true }.
  • Numbers: also { increment }, { decrement }, { multiply }.
  • References: { connect: { naturalKey: "..." } }, { disconnect: true }, or { setNull: true }.
  • Lists: { set }, { push }, { pull }, { splice: { start, deleteCount, insert } }, { removeWhere }.
  • Composite (inline) fields: { update: { ... } } to patch in place, or { set: { ... } } to replace wholesale.
mutation UpdatePage { updatePage( where: { naturalKey: { eq: "about" } } data: { title: { set: "About Us -- Updated" } body: { set: "Updated content..." } } changeDescription: "Updated page title" ) { record { _id _updatedAt title } replayed } }

The same write through the data client:

const { record: page } = await foir.page.update({ where: { naturalKey: { eq: 'about' } }, data: { title: { set: 'About Us -- Updated' }, body: { set: 'Updated content...' }, }, changeDescription: 'Updated page title', });

changeDescription is accepted on versioned models; variantKey is accepted on variant models to route the write to a variant child (created on demand). Neither naturalKey nor id is part of an update: a record’s key changes through rename<Model>, and its id never changes.

idempotencyKey makes the update safe to retry: sent again with the same key, it answers with the first attempt’s result instead of applying the update again, and replayed is true. An update that would act again if repeated (one using increment, decrement, multiply, push or splice) is refused with INVALID_ARGUMENT unless it carries one, because a retry of it would otherwise count twice. Updates made only of set, setNull, connect and the other operators land on the same state however often they are sent, and need no key.

Required scope: records:write

Rename a Record

rename<Model>(where: <Model>WhereInput!, naturalKey: String!, idempotencyKey: String) changes the key a record is addressed by. where must match exactly one record, and the record’s content is unchanged. A key another record of the model already holds is refused with ALREADY_EXISTS.

mutation RenamePage { renamePage(where: { naturalKey: { eq: "about" } }, naturalKey: "about-us") { record { _id _naturalKey } replayed } }
const { record: page } = await foir.page.rename({ where: { naturalKey: { eq: 'about' } }, naturalKey: 'about-us', });

Required scope: records:write

Update Many Records

updateMany<Model>(where: <Model>WhereInput, data: <Model>UpdateInput!, idempotencyKey: String) applies the same typed update to every record matching the predicate. where is optional: omitting it matches every record in the model, so always scope it. It returns { count, ids, replayed }.

idempotencyKey works as it does on update<Model>: sent again with the same key, the call answers with the first attempt’s result instead of applying again to every matched record. An update that would act again if repeated (a multiply, as below, or an increment) is refused with INVALID_ARGUMENT unless it carries one.

mutation MarkOnSale { updateManyProduct( where: { category: { eq: "electronics" } } data: { price: { multiply: 0.9 } } idempotencyKey: "sale-electronics-2026-09" ) { count ids replayed } }
const { count, ids, replayed } = await foir.product.updateMany({ where: { category: { eq: 'electronics' } }, data: { price: { multiply: 0.9 } }, idempotencyKey: crypto.randomUUID(), });

Required scope: records:write

Atomic Field Operations

Atomic field updates are expressed through the update operator tree, not a separate operations array. They are evaluated server-side without a read-modify-write round trip. An update using one that acts again when repeated needs an idempotencyKey (see Update a Record); generate one per logical update and reuse it on retries:

mutation IncrementViewCount { updateArticle( where: { id: { eq: "rec_abc123" } } data: { viewCount: { increment: 1 } tags: { push: ["featured"] } lastViewed: { set: "2026-04-01T12:00:00Z" } } idempotencyKey: "view-rec_abc123-7f3c9a" ) { record { _id viewCount tags } replayed } }

The operator tree is the same tree through the data client. The update arguments are the GraphQL field’s own arguments, so nothing is re-spelled:

const { record: article } = await foir.article.update({ where: { id: { eq: 'rec_abc123' } }, data: { viewCount: { increment: 1 }, tags: { push: ['featured'] }, lastViewed: { set: '2026-04-01T12:00:00Z' }, }, idempotencyKey: crypto.randomUUID(), });
OperatorApplies toEffect
setany fieldReplace the value
setNullany fieldClear the value (set to null)
increment / decrement / multiplynumberAdjust the numeric value in place
pushlistAppend items
pulllistRemove matching items
splicelistInsert/remove at an index (start, deleteCount, insert)
removeWherelistRemove items matching the item’s where shape
connect / disconnectreferencePoint at / clear a referenced record

Delete a Record

delete<Model>(id: String!) permanently deletes a record and returns true. This cannot be undone.

mutation DeletePage { deletePage(id: "rec_abc123") }
await foir.page.delete({ id: 'rec_abc123' });

Required scope: records:delete

Refresh a Record’s Cached Answers

refresh<Model>(id: ID, naturalKey: String) clears what the API has cached for one record, named by its id or by its key, so its next read resolves it again. The record itself is unchanged. It returns false when there is no such record for your key to refresh.

A write already clears a record’s cached answers. Call this when the record’s content changed somewhere else: typically a field read live from another service, whose answer is cached for as long as that field says. An app reading a product’s price from a store calls it when the store reports the product changed.

mutation RefreshProduct { refreshProduct(naturalKey: "summer-shirt") }
await foir.product.refresh({ naturalKey: 'summer-shirt' });

Required scope: records:write, for the model. Refreshing is part of what a write does, so a key that may write the model may refresh it.

Publish a Version

For versioned or publishable models, publish a specific version to make it available via live keys. Returns true on success.

mutation PublishPage { publishPageVersion(versionId: "ver_xyz789") }
await foir.page.publishVersion({ versionId: 'ver_xyz789' });

Required scope: records:publish

Unpublish a Record

Remove a record from the published API. Returns true on success.

mutation UnpublishPage { unpublishPage(id: "rec_abc123") }
await foir.page.unpublish({ id: 'rec_abc123' });

Required scope: records:publish

Batch Operations

batchRecordOperations processes multiple create, update, and delete operations across any models in a single request. Each operation declares its type and the fields that type needs:

No SDK equivalent — every operation in the batch names its model as a runtime string and comes back as an untyped result, so nothing generated from a per-model manifest can type it. The typed per-model operations are the data client’s whole point; an untyped door beside them would be a downgrade, not parity. Loop the typed ops, or send this one through /graphql.

mutation BatchOps { batchRecordOperations(input: { operations: [ { type: CREATE modelKey: "product" naturalKey: "blue-widget" data: { name: "Blue Widget", price: 29.99 } } { type: UPDATE modelKey: "product" id: "rec_existing123" data: { price: 24.99 } } { type: DELETE id: "rec_old456" } ] }) { created updated deleted errors { type index message } } }

modelKey is required for CREATE and UPDATE; id is required for UPDATE and DELETE. The result reports per-type counts plus an errors list carrying each failing operation’s index — its position in the array you sent — its type, and a message.

A failed operation does not abort the batch. The rest still run, and the counts report what succeeded.

Required scopes. records:write is what the field costs to enter; it is not the whole gate. A batch mixes verbs across models, so each operation is charged the scope its typed equivalent would cost, against the model the record is actually stored under:

OperationCosts
CREATErecords:write, against the modelKey it names
UPDATErecords:write, against the model the record is stored under
DELETErecords:delete — not records:write

records:write does not imply records:delete anywhere else in the grammar and does not here. A key holding only records:write gets its deletes refused as per-operation errors while its creates and updates go through.

The model checked for an UPDATE or DELETE is the one the record is genuinely stored under, not the modelKey in the payload — so naming a model you hold a grant for does not widen what a record id reaches.

API keys only. A scoped or callback token cannot use this field; it gets a refusal saying so. Use the typed per-model mutations instead.

Operations API

The Operations API lets you execute custom server-side operations from your frontend or backend. Operations are registered endpoints that extend the platform with custom logic like data processing, AI workflows, or business automation.

Prerequisites

  1. Register the operation in the dashboard with an endpoint URL
  2. Enable the API touch point on the operation
  3. Create an API key with the operations:execute scope

Execute an Operation

Each operation gets its own typed mutation named execute<Operation>, where <Operation> is the PascalCase form of the operation key. An operation with the key contact-form-handler becomes executeContactFormHandler. The input argument is a typed input object generated from the operation’s input schema.

mutation RunContactForm { executeContactFormHandler( input: { name: "Jane Doe" email: "jane@example.com" message: "I have a question about your enterprise plan..." } mode: SYNC ) { execution { id operationKey status } result } }

The data client addresses an operation by its key, not by the generated field name. The op is execute.<key>, which is not a legal property name, so it is reached with bracket access:

const payload = await foir.ns.operations['execute.contact-form-handler']({ input: { name: 'Jane Doe', email: 'jane@example.com', message: 'I have a question about your enterprise plan...', }, mode: 'SYNC', });

Note: operations is the one namespace whose op names are not its GraphQL root field names. foir types emits one execute.<key> entry per operation your key can execute, so foir.ns.operations['execute.contactFormHandler'] — the field name — is a compile error, and so is any key your project does not declare. The bookkeeping ops below (operationExecution, operationExecutions, cancelOperationExecution) are platform fields and use their own names unprefixed.

Arguments:

ArgumentTypeDescription
input<Operation>InputTyped input matching the operation’s declared input schema
modeExecutionModeSYNC (default) calls the operation’s endpoint directly and returns its result, bounded by the operation’s timeout; ASYNC returns the execution row immediately so you can poll for the result. ASYNC is only accepted by operations that support it.
idempotencyKeyStringNames one logical action, so a retry of it does not run the operation again: it adopts the execution the key last started while that execution is running or completed, and starts a new one after a failure. Send the same key when retrying one logical action. See Retrying safely.
concurrencyKeyStringNames work of which one run should be in flight at a time: while a run started under the key is in flight, a call under it joins that run and starts nothing. Once the run has ended, the next call starts a new one.

The mutation returns an Execute<Operation>Payload envelope:

  • execution: the execution row (always present). Use execution.id to poll the status later.
  • result: the typed result, populated on SYNC completion and null on ASYNC dispatch. The result shape is generated from the operation’s declared output schema; operations without one expose a result: JSON field.
  • replayed: true when idempotencyKey matched an execution that was running or had completed, so this call adopted it and the operation did not run again. An adopted execution that is still running comes back at once, with result still null.
  • joined: true when concurrencyKey matched a run in flight, so this call joined it and the operation was not started again.
  • supersededExecutionId: set when idempotencyKey’s last execution had failed, timed out or been cancelled: that execution’s id. A failure is not adopted, so this call started a new execution instead.

A SYNC operation that fails returns a GraphQL error rather than a payload.

Check Execution Status

With a publishable or a server key, reading, listing, cancelling or subscribing to runs requires a signed-in user. Users can access only their own runs. Admin keys and console sessions use their existing read reach. A visitor through a publishable or a server key has only what the key gives, so executing an operation with one also needs a signed-in user whose role grants operations:execute (or that operation by name), or what the key gives naming the operation.

For ASYNC operations, poll the execution status using the id returned in execution:

query GetExecution { operationExecution(id: "exec_abc123") { id operationKey status result error startedAt completedAt createdAt } }
const execution = await foir.ns.operations.operationExecution({ id: 'exec_abc123' });

result is JSON (the raw operation output) and error is a String message present when status is FAILED or TIMED_OUT. A run your credential cannot read returns null, the same answer as a run that does not exist.

Execution statuses: PENDING, DISPATCHED, RUNNING, COMPLETED, FAILED, CANCELLED, TIMED_OUT

Cancel an Execution

Use the generic cancelOperationExecution mutation, which returns a Boolean indicating success. It is idempotent.

mutation CancelExecution { cancelOperationExecution(id: "exec_abc123") }
await foir.ns.operations.cancelOperationExecution({ id: 'exec_abc123' });

List Executions

operationExecutions returns a Relay-style cursor connection. Filter by operationKey and/or status, and page with first/after. A list the platform refuses (for example, an X-Org-Id naming a suspended organisation) is a GraphQL error carrying the refusal’s code, never an empty page; an empty page means there are no matching runs. A loop that pages through history should stop on the error rather than treat it as the end.

query ListExecutions { operationExecutions( operationKey: "contact-form-handler" status: COMPLETED first: 20 ) { edges { node { id operationKey status createdAt completedAt } cursor } pageInfo { hasNextPage endCursor } totalCount } }
const executions = await foir.ns.operations.operationExecutions({ operationKey: 'contact-form-handler', status: 'COMPLETED', first: 20, });

Polling for Results

async function waitForResult(client, executionId) { const MAX_ATTEMPTS = 30; const POLL_INTERVAL = 2000; for (let i = 0; i < MAX_ATTEMPTS; i++) { const { data } = await client.query({ query: GET_EXECUTION, variables: { id: executionId }, fetchPolicy: "network-only", }); const execution = data.operationExecution; if (execution.status === "COMPLETED") return execution.result; if (execution.status === "FAILED") throw new Error(execution.error); if (execution.status === "CANCELLED") throw new Error("Operation cancelled"); await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL)); } throw new Error("Timed out waiting for operation result"); }

Search and Embeddings

Foir provides search powered by vector embeddings, allowing you to find content by meaning rather than exact keywords. Search queries are available for models that have embeddings enabled in their configuration.

Search a Model

Each model with embeddings enabled gets a typed search<Model>s query: the PascalCase model key with an s appended, whatever the model’s plural (searchProducts, and searchCategorys for a category model). It takes a natural-language query and returns the matching records ranked by similarity.

query SearchProducts { searchProducts(query: "lightweight shoes for trail running", first: 10) { score record { _id title } } }

search is a model op on the data client, so it hangs off the model rather than being a separate root field:

const hits = await foir.product.search({ query: 'lightweight shoes for trail running', first: 10, });

Arguments:

ArgumentTypeDescription
queryString!Natural-language search query
firstIntMaximum number of matches to return (default: 10)
localeStringOptional locale for the matched records

Response fields:

FieldTypeDescription
scoreFloat!Similarity score
recordthe model’s typed objectThe matching record

Required scope: search:read:<modelKey>

Search Across Models

searchRecords runs the same similarity search and returns generic results, optionally scoped to a single model:

query SearchEverything { searchRecords(query: "trail running", modelKey: "product", first: 10) { recordId modelKey naturalKey score content } }

searchRecords has no model behind it, so on the data client it lives on the search namespace rather than on a model:

const hits = await foir.ns.search.searchRecords({ query: 'trail running', modelKey: 'product', first: 10, });

Namespace ops return their result verbatim — there is no model to shape, so include and omit are not offered on them.

The result fields are recordId (String!), modelKey (String!), naturalKey (String), score (Float!), and content (JSON, the matched record’s data).

Required scope: search:read

Search by Embedding Vector

If you already have an embedding vector, searchEmbeddings finds similar records directly. findSimilarRecords does the same starting from an existing record. Both return a cursor connection of the same SearchResult that searchRecords returns as a list, so page them with first and after.

query SimilarByVector { searchEmbeddings(input: { embedding: [0.0123, -0.045, 0.067] modelKeys: ["product"] first: 10 }) { edges { node { recordId modelKey score content } } pageInfo { hasNextPage endCursor } } } query SimilarToRecord { findSimilarRecords(input: { recordId: "rec_abc123", modelKey: "product", first: 10 }) { edges { node { recordId modelKey score content } } pageInfo { hasNextPage endCursor } } }

Both are search namespace ops, and both take the same input object the GraphQL field takes:

const byVector = await foir.ns.search.searchEmbeddings({ input: { embedding: [0.0123, -0.045, 0.067], modelKeys: ['product'], first: 10 }, }); const similar = await foir.ns.search.findSimilarRecords({ input: { recordId: 'rec_abc123', modelKey: 'product', first: 10 }, });

SearchEmbeddingsInput fields: embedding ([Float!]), modelKeys ([String!]), key (String), first (Int), after (String), threshold (Float), hybridWeight (Float), textQuery (String). Pass exactly one of embedding and textQuery. FindSimilarRecordsInput fields: recordId (ID!), modelKey (String), first (Int), after (String).

Required scope: embeddings:read

Read a Record’s Embeddings

embeddingsForRecord lists the stored embeddings for a record:

query RecordEmbeddings { embeddingsForRecord(recordId: "rec_abc123") { id recordId modelKey key createdAt } }

The same read through the data client:

const embeddings = await foir.ns.search.embeddingsForRecord({ recordId: 'rec_abc123' });

Required scope: embeddings:read

Write and Generate Embeddings

To supply your own vectors, use writeEmbeddings; to queue server-side generation for a record, use generateEmbedding; to remove them, use deleteEmbeddings. Each returns a Boolean.

mutation StoreEmbeddings { writeEmbeddings(input: { entries: [ { recordId: "rec_abc123", embedding: [0.0123, -0.045, 0.067] } ] }) } mutation GenerateEmbedding { generateEmbedding(recordId: "rec_abc123", modelKey: "product") } mutation RemoveEmbeddings { deleteEmbeddings(input: { recordId: "rec_abc123" }) }

The same three through the data client. A publishable key enumerates only the search reads, so generate your types with a key that holds embeddings:write or these are not on the client:

await foir.ns.search.writeEmbeddings({ input: { entries: [{ recordId: 'rec_abc123', embedding: [0.0123, -0.045, 0.067] }] }, }); await foir.ns.search.generateEmbedding({ recordId: 'rec_abc123', modelKey: 'product' }); await foir.ns.search.deleteEmbeddings({ input: { recordId: 'rec_abc123' } });

EmbeddingEntryInput fields: recordId (ID!), embedding ([Float!]!), key (String), contentHash (String), metadata (JSON). generateEmbedding also accepts an optional source (String).

Required scope: embeddings:write

User Authentication

The User Auth API provides authentication flows for end users, supporting password, OTP, and OAuth/OIDC methods. For hosted sign-in (Foir hosts the sign-in page so you don’t build one), see the hosted sign-in guide.

In the SDK: @foir/sdk/auth makes every request in this section, one function each, and keeps the session each one mints or ends: it stores the token, schedules its refresh and survives a redirect. Each operation below names its function. Your manifest publishes the same operations as the auth namespace, so foir.ns.auth.currentUser() and the rest are typed operations on the data client too. Authenticate with @foir/sdk/auth, then hand the token to the data client; see User authentication.

Every token-issuing mutation returns the same AuthResult:

type AuthResult { token: String! # short-lived EdDSA access token — send as a Bearer refreshToken: String! userId: String! email: String! }

Sign in with a password

In the SDK: signInWithPassword(adapter, env, { email, password }) in @foir/sdk/auth makes this request and keeps the session it mints.

mutation SignIn { signIn(email: "person@example.com", password: "securepassword") { token refreshToken userId email } }

Register a User

In the SDK: signUpWithPassword in @foir/sdk/auth makes this request and answers the step, and signInWithOTP with that step and the emailed code finishes the account and keeps the session. register makes the call alone.

mutation Register { register(email: "new@example.com", password: "securepassword") }

register returns a SignInStep! and signs nobody in. A code is mailed to the address, and bringing it back to the step’s route (below) signs the person in and finishes the account. Every address is answered a step, whether or not an account already holds it.

Sign out

Ends the provider tokens of the sign-in the user’s token belongs to: this device’s, and no other device’s. Returns Boolean. It does not revoke a refresh-token family and does not end a session. To end the refresh family too, POST the refresh token to /oauth/revoke, naming your auth client with client_id (or HTTP Basic for a confidential client).

In the SDK: signOut(adapter, env) in @foir/sdk/auth makes this request with the session’s token, then clears the session.

mutation SignOut { signOut }

OTP Authentication

In the SDK: requestOTP in @foir/sdk/auth sends the code and answers its step, and signInWithOTP(adapter, env, { step, otp }) brings the code back to it and keeps the session.

Ask for a one-time code. It answers the step the code is brought back to:

mutation RequestOTP { requestOTP(email: "person@example.com") { id token endpoint expiresAt } }

Every address is answered a step alike, so the answer says nothing of whether the address has an account. Bring the code back to the step’s own route with its token. It takes no key, since the token is the credential:

POST /v1/sign-ins/{id}/code Content-Type: application/json X-Foir-Token: <the step's token> {"code": "123456"}

It answers the session:

{ "accessToken": "eyJhbGciOi...", "refreshToken": "rt_...", "user": { "id": "usr_...", "email": "person@example.com" } }

A wrong code is answered 401 with "code": "UNAUTHENTICATED". A step’s code lapses with the step, at expiresAt, and a step signs somebody in once.

Token Refresh

Refresh tokens rotate on every use — save the new one before responding to the user.

In the SDK: refreshSession(adapter, env) in @foir/sdk/auth makes this request with the stored refresh token and keeps the rotated pair, and authedRequest and authedOp refresh and retry a call that met an expired token.

mutation RefreshToken { refreshToken(refreshToken: "eyJ...") { token refreshToken userId email } }

Get Current User

Requires a valid user access token in the Authorization header:

In the SDK: currentUser in @foir/sdk/auth makes this request with the user’s token, and getSessionUser(adapter) reads the user the session holds without one. foir.ns.auth.whoami() answers a different question: what the key on a data-client request can do.

query CurrentUser { currentUser { id email status emailVerifiedAt createdAt } }

A Provider’s Token

The token of the provider a user signed in through, such as Shopify’s customer token, read with their access token in the Authorization header. It belongs to the sign-in that obtained it: every token your app is given from that sign-in reads it, a “Continue as” included, and a sign-in on another device keeps its own.

In the SDK: myProviderToken in @foir/sdk/auth makes this request with the user’s token.

query ShopifyToken { myProviderToken(providerKey: "shopify") { linked accessToken expiresAt refresh refreshFailure reauthenticate } }

The token is renewed when it is read and due: near the expiry the provider stated, or at any age when the provider stated none. Two reads at once renew it once, so a page whose loaders run side by side gets one renewed token, not one renewed and one refused. refresh says what the read did: REFRESHED, FAILED (with refreshFailure naming where), HELD_BACK when it was tried in the last minute, or NOT_ATTEMPTED when it is fresh.

When the provider refuses the token you were given, ask again with forceRefresh: true. A token is renewed at most once a minute for one sign-in and provider. reauthenticate: true means only the user signing in with the provider again mends the connection: show them the way to do that. It comes with linked: false when nothing is kept for this sign-in, because it did not pass through the provider or its token was ended by signing out. The query answers null when no user is signed in.

Password Management

In the SDK: requestPasswordReset, resetPasswordAndSignIn and updatePassword in @foir/sdk/auth make these requests. resetPasswordAndSignIn keeps the session the reset mints.

Request a password reset (returns Boolean):

mutation RequestReset { requestPasswordReset(email: "person@example.com") }

Redeem the emailed token on the reset’s own route. It takes no key, since the token is the whole credential:

POST /v1/password-resets/redeem Content-Type: application/json {"token": "reset_token_here", "newPassword": "newsecurepassword"}

It answers the reset, with the session it opens where your project lets its own app sign people in:

{ "success": true, "accessToken": "eyJhbGciOi...", "refreshToken": "rt_...", "user": { "id": "usr_...", "email": "person@example.com" } }

A spent or unknown token is answered 401 with "code": "UNAUTHENTICATED". Send projectId and clientId as well when the link names them, so the token is redeemed only where it was asked for.

Update password (authenticated; returns Boolean):

mutation UpdatePassword { updatePassword(currentPassword: "oldpassword", newPassword: "newpassword") }

Auth Providers (OAuth/OIDC)

List available authentication providers:

In the SDK: signInWithProvider(adapter, env, input) in @foir/sdk/auth starts the handshake, keeps the step its finish is brought back to in the session store across the redirect, and answers the address to send the browser to. finishProviderSignIn(adapter, env, { providerKey, code, state }) finishes it on that step and keeps the session. @foir/sdk/react and @foir/sdk/next wire both to the browser’s redirect. The data client picks up once a token exists.

query ListProviders { authProviders { key name type isDefault } }

Sign in with a provider. It answers a server-built redirectUrl to send the browser to, and the step the sign-in finishes on. Keep the step across the redirect (in session storage, or a cookie your server reads):

mutation ProviderSignIn { signInWithProvider(input: { providerKey: "google" returnTo: "https://mysite.com/callback" }) { redirectUrl step { id token endpoint expiresAt } } }

Per-call redirectUri override

Multi-environment storefronts (e.g. eide.clothing plus preview.eide.clothing) can share a single upstream OAuth client by passing redirectUri on the mutation input:

In the SDK: signInWithProvider in @foir/sdk/auth takes redirectUri in its input too.

mutation ProviderSignIn { signInWithProvider(input: { providerKey: "shopify" redirectUri: "https://preview.eide.clothing/auth/callback?provider=shopify" }) { redirectUrl } }

The supplied URI is validated against an allowlist on the provider’s config:

  • It must equal the configured primary redirect_uri exactly, or appear in the additional_redirect_uris array.
  • It must be https://, have a host, and contain no fragment.
  • It must also be pre-registered with the upstream IdP (Shopify, Google, etc.) — that side of the allowlist is your responsibility.

If redirectUri is omitted, the provider’s primary redirect_uri is used (existing behaviour, no breaking change). If supplied but not in the allowlist, the mutation fails with InvalidArgument before the IdP is contacted, so an attacker holding an API key cannot point the OAuth flow at an arbitrary URL.

Configure additional URIs in the dashboard’s Auth Provider editor under “Additional Callback URLs” (one per line), or directly via the provider’s additional_redirect_uris config field.

Handle the OAuth callback by bringing what the provider returned back to the step, with its token. It takes no key:

POST /v1/sign-ins/{step.id}/provider Content-Type: application/json X-Foir-Token: <the step's token> {"providerKey": "google", "code": "auth_code_from_redirect", "state": "state_parameter"}

It answers the session:

{ "userId": "usr_...", "email": "person@example.com", "accessToken": "eyJhbGciOi...", "refreshToken": "rt_..." }

Where the provider names an address somebody already holds and does not prove it is theirs, the sign-in waits for a code sent to that address. The answer is 412 with "providerSignIn": {"code": "link_code_sent", "pending": "..."}. Post the code to POST /v1/sign-ins/{step.id}/link with {"pending": "...", "code": "..."}, or ask for a fresh one at POST /v1/sign-ins/{step.id}/link/resend with {"pending": "..."}, each with the same token.

Auth Configuration

Check what authentication methods are available for your project:

In the SDK: getAuthConfig in @foir/sdk/auth makes this request, and getAuthProviders and getDefaultAuthProvider read the providers. Each is read before the caller holds a credential.

query AuthConfig { authConfig { passwordEnabled otpEnabled providers { key name type } } }

Schemas API

The Schemas API returns your project’s model definitions, designed for code generation and the Foir CLI.

Required scope: schemas:read, which a key of any kind may hold — schemas is a public-safe resource, so a publishable key carrying the scope reaches this query exactly as an admin key does.

query GetProjectSchemas { projectSchemas }

The same read through the data client, in the project namespace:

const schemas = await foir.ns.project.projectSchemas();

projectSchemas is a JSON scalar, so it takes no selection set. It returns one object:

{ "dataModels": [ { "handle": "blog-post", "name": "Blog Post", "description": "Articles for the blog", "pluralName": "Blog Posts", "pluralKey": "blogPosts", "fields": [{ "key": "title", "label": "Title", "type": "text", "required": true }] } ] }

Each entry’s handle is the model key, and fields holds the model’s field definitions as the project declares them. Inline models are listed too, without pluralName and pluralKey.

Field Types

Common field types returned in schema definitions:

TypeDescription
textSingle-line text
proseTranslatable rich text (resolves to { html, markdown, json, entries }; entries is the typed reading)
integerWhole number (Int; refused beyond ±2^53)
decimalExact decimal, carried as a string (Decimal)
booleanTrue/false
dateDate (can include time)
selectReference to records of an option model
enumChoice from inline { label, value } options
imageImage file
videoVideo file
fileGeneric file
jsonRaw JSON
listOrdered list of items
modelEmbedded inline model
referenceRelation to another record
geopointA latitude/longitude point, materialised into PostGIS so records can be queried by proximity

Using Schemas for Code Generation

foir types generates your app’s typed client from the manifest, and is the route to take. A build script of your own can read the schema response instead, with an admin key held by that tooling, never by your app:

curl -X POST https://api.foir.dev/graphql \ -H "Content-Type: application/json" \ -H "x-api-key: foir_adm_your_admin_key" \ -d '{"query": "{ projectSchemas }"}'

The Foir CLI provides built-in support for schema-driven code generation:

foir models list --json foir models get blog-post --json

Models Query

List the models available in your project. models returns a plain list of Model (no pagination wrapper) and accepts an optional category filter. It requires a key with the schemas:read scope.

query GetModels { models { key name pluralName pluralKey description category capabilities { isVersioned isPublishable hasVariants } fields { key label type required helpText config } } }

The same list through the data client, also in the project namespace:

const models = await foir.ns.project.models();

Each Model exposes key, name, description, pluralName, pluralKey, category, a capabilities object (isVersioned, isPublishable, hasVariants), and the model’s fields. Each field carries key, label, type, required, helpText, and a config JSON blob. Only models exposed to the public API are returned.

Secret Vault

Server-side integrations can store and read project-scoped secrets through the vault. All three fields require an admin key holding the matching scope — neither a publishable nor a server key can be granted these scopes. The plaintext travels base64-encoded over the String scalar so binary secrets survive the round trip.

# Store a secret — returns an opaque ref; persist only the ref, never the plaintext mutation { putSecret(plaintextBase64: "c3VwZXItc2VjcmV0", label: "stripe-webhook-key") { ref } } # Read it back by ref query { getSecret(ref: "sec_abc123", purpose: "webhook-verify") { plaintextBase64 label lastWrittenAt } } # Soft-delete mutation { deleteSecret(ref: "sec_abc123") }

The vault is a namespace on the data client — it has no model behind it, so the op name is the root field’s:

const { ref } = await foir.ns.secrets.putSecret({ plaintextBase64: 'c3VwZXItc2VjcmV0', label: 'stripe-webhook-key', }); const secret = await foir.ns.secrets.getSecret({ ref, purpose: 'webhook-verify' }); await foir.ns.secrets.deleteSecret({ ref });

foir.ns.secrets exists only on a client generated from a key holding these scopes. Under a publishable key it is not on the type at all, because the manifest that generated the types never mentioned it.

Note: for the same reason, these three op names cannot be checked from a publishable key. Confirm them against GET /v1/manifest (.namespaces.secrets) with the admin key you intend to use.

FieldScopeNotes
getSecret(ref, purpose)secrets:readReturns SecretPlaintext { plaintextBase64, label, lastWrittenAt }.
putSecret(plaintextBase64, label, expiresAt)secrets:putReturns PutSecretResult { ref }. Always stored project-owned.
deleteSecret(ref)secrets:deleteReturns Boolean!.

Files

File uploads, the File type, listing, and the lifecycle mutations (deleteFile, undeleteFile, purgeFile) are covered in the Files API. Image transforms on File.url live in the Media API.

Type Reference

Typed record objects

Each model produces its own typed object. There is no shared generic Record type. Your declared fields appear at the top level alongside the system fields. For a Page model with title and body fields:

type Page { # System fields (on every record type) _id: String! _naturalKey: String _modelKey: String! _createdAt: DateTime! _updatedAt: DateTime! _hasDraft: Boolean _ownerId: String _ownerKind: String _variant: String _segments: JSON # requires targeting:debug _resolvedBy: String # requires targeting:debug # Declared fields title: String body: String }

Connection types

Plural queries return a Relay connection:

type PageConnection { edges: [PageEdge!]! pageInfo: PageInfo! totalCount: Int! } type PageEdge { node: Page! cursor: String! } type PageInfo { hasNextPage: Boolean! hasPreviousPage: Boolean! startCursor: String endCursor: String }

RecordVersion

type RecordVersion { id: String! versionNumber: Int! changeDescription: String data: JSON createdAt: DateTime! }

Operation execute payload

Each execute<Operation> mutation returns its own Execute<Operation>Payload carrying the execution row and the typed result:

type ExecuteContactFormHandlerPayload { execution: OperationExecution! result: ContactFormHandlerOutput } type OperationExecution { id: String! operationKey: String! status: OperationExecutionStatus! result: JSON error: String startedAt: DateTime completedAt: DateTime createdAt: DateTime! }

The result field on the payload is typed from the operation’s declared output schema (operations without one expose result: JSON). OperationExecution is also the type returned by the operationExecution query and the nodes of the operationExecutions connection.

AuthResult

Returned by every token-issuing user mutation (signIn, refreshToken).

type AuthResult { token: String! refreshToken: String! userId: String! email: String! }

CurrentUser

Returned by the currentUser query.

type CurrentUser { id: String! email: String! status: AuthUserStatus! emailVerifiedAt: DateTime createdAt: DateTime! }
Last updated on