Skip to main content
Guide
HelixDB accepts Cypher statements alongside its native operation-tree queries. Both languages run against the same graph, transactions, and indexes, so data written with one is visible to the other, and existing databases need no migration. Cypher support is a profile of openCypher, not full compatibility. The clauses, expressions, and functions listed under What is supported run. Everything in What is not supported is rejected with a specific error before the statement reads or writes anything. Cypher as described here is served by local servers running the ghcr.io/helixdb/helixdb:v0.0.13 image or later, and by Helix Cloud gateways.
The SDK examples below need TypeScript 4.0.0, Python 0.4.0, Rust 4.0.0 or Go v0.4.0. TypeScript 3.2.0, Python 0.3.4, Rust 3.0.0 and Go v0.3.1 do not include the Cypher methods; with those releases, use the HTTP API to run and explain statements.

Run a statement

Send one statement, with optional parameters and a query name, to POST /v2/cypher. The server works out whether the statement reads or writes.
A successful response has ordered columns and rectangular rows, with one value per column in column order:
query is required; parameters and query_name are optional. Duplicate rows are kept unless the statement uses DISTINCT, and row order is only defined by ORDER BY. A write without RETURN succeeds with empty columns and rows. Parameters hold values. Labels, relationship types, and variable names are part of the statement, so keep values in parameters instead of building them into the query text.

Over HTTP

A local server has no authentication:
A Helix Cloud gateway takes the same body. Authenticate as for POST /v2/query, with the cluster API key and, on a GA shared gateway, the database ID:
The gateway routes each statement by what it does: reads go to readers, and writes go to the elected writer. A read-only API key can read and explain, but receives 403 for a statement that writes. The HTTP API reference describes the headers, status codes, and lossless value encoding in full.

From the CLI

From a linked local project, helix cypher runs a statement against the local instance:

Request options

The native request options apply to Cypher too: Writes wait for durability by default. Skipping the wait returns once the write is applied on the writer, so a crash before its WAL upload loses it. See execution headers for how local servers and Helix Cloud handle each option. Rust and TypeScript set options on request_builder() / requestBuilder() before .cypher(...); Go and Python pass them to Cypher and cypher. A warm-only read that Helix Cloud answers with 204 No Content returns no rows. Embedded clients reject request options.

Explain a statement

POST /v2/cypher/explain takes the same body and plans the statement without running it, so explaining a write changes nothing. The plan reports the statement’s effect (Read or Write), its bindings, the selected access paths such as index lookups, estimated cardinalities, blocking work, Cartesian products, and optimizer warnings. Planning checks parameters, so supply every parameter the statement uses.

What is supported

Create and read a small graph:
The WHERE of a WITH filters the rows that clause returns, after its DISTINCT, ORDER BY, SKIP, and LIMIT: WITH x ORDER BY x LIMIT 3 WHERE x > 2 keeps at most the third row. After SKIP or LIMIT, only the variables the WITH projects remain in scope. value =~ pattern is true when the regular expression matches the whole string, as in openCypher, and null when either side is null or not a string. Patterns use the Rust regex syntax of the native grep step and matches predicate: linear time, no look-around or backreferences, and Unicode-aware. (?i) ignores case and (?s) lets . match a newline. A Cypher string writes one backslash as \\, so 'NCT\\d{8}' is the pattern NCT\d{8}. A pattern that is not a valid regular expression, or is longer than 4 KiB, is a syntax_error with detail invalid_regex when it is a literal or a string parameter, directly, as a map parameter’s property, or through a variable projected from either (WITH $p AS p, WITH '(' AS p). The statement fails before any row is read, so the error does not depend on the data. A pattern computed from other values, such as $p + '' or a property, is checked when a row evaluates it, and an invalid one fails with argument_error and invalid_regex.

What is not supported

These constructs are valid openCypher but outside the profile. Each is rejected before anything runs, with the error category unsupported_feature and the details.detail code shown, unless the table says otherwise. Instead of MERGE, upsert with a unique index. Instead of FOREACH, UNWIND a list parameter. Some of these fail as ordinary compile errors instead:
  • CREATE INDEX ... is a syntax_error (unexpected_syntax). Create indexes with the native secondary, vector, and text index APIs; Cypher planning then uses compatible indexes automatically.
  • A relationship in CREATE needs exactly one type and a direction, otherwise the statement is a syntax_error (no_single_relationship_type).
  • A parameter map in a MATCH pattern, such as MATCH (n:User $props), is a syntax_error (invalid_parameter_use). Write the properties as a map literal, such as {email: $email}.
  • An unrecognized function name is a syntax_error (unknown_function). That includes elementId(); use id().
  • A statement that is also invalid openCypher reports the standard error, such as variable_already_bound for a CREATE that redeclares a variable.
Vector search, full-text search, and index management have no Cypher syntax; use native queries for them. Cypher is served over HTTP, gRPC, the SDKs, and the CLI. The Bolt protocol and Bolt drivers are not supported.

Values and parameters

Nulls, booleans, strings, lists, maps, and finite floats use ordinary JSON values, in parameters and in results. Integers inside JavaScript’s safe range use JSON numbers. Larger integers and non-finite floats use tagged values: Node and relationship IDs are unsigned decimal strings in separate namespaces; keep them as strings. id() reports an overflow when an ID does not fit a signed 64-bit integer. Relationship endpoints keep their stored direction even when a path traverses them in reverse. Internal metadata is left out of property maps. Scalars, lists, and maps, including their tagged forms, can be passed as parameters; nodes, relationships, and paths cannot. The SDKs keep tagged values in results. TypeScript also accepts bigint parameters and sends them tagged. A datetime result is plain text, so it reads the same as a string holding that text. A typed date_time parameter of an in-process request binds as a datetime; JSON parameters have no datetime form, so read datetime text with datetime($at), which still uses indexes.

Writes and transactions

Each statement that writes runs in one transaction, including its index changes. If any clause fails, nothing the statement wrote is kept.
  • A created node needs exactly one non-empty label, and a created relationship exactly one non-empty type. MATCH without a label scans all nodes.
  • Stored properties are scalars or lists of one scalar type. Maps and nested lists can be used in expressions but not stored, so storing one fails the statement.
  • SET n += {...} updates the given keys and keeps the rest. SET n = {...} replaces every user property. Setting a property to null removes it. SET items run in order, so later items see earlier changes.
  • A plain DELETE of a node that still has relationships fails the statement. DETACH DELETE removes the relationships and the node.
  • Index rules still apply: a value an index cannot store fails the statement, including a string too large for an index key (about 64 KiB).
  • Do not retry a write automatically when its commit outcome is uncertain; see error handling.

Upsert without MERGE

To create a node, or update it if it exists, let a unique index decide:
  1. Create a unique equality index on the key property, such as email on User.
  2. Send the CREATE:
  3. On 409 unique_constraint_violation, the node exists and nothing was written. Update it instead:
  4. If the update returns no rows, the node was deleted in between; go back to step 2.
Without a unique index, concurrent CREATEs, or reading first and creating when nothing matched, add duplicates. An UNWIND batch fails as a whole on its first duplicate, so to upsert a batch, MATCH its keys first, CREATE the missing rows, and update the rest; the index still rejects a row another client created meanwhile.

Functions, aggregation, and grouping

  • toInteger() and toInt() convert decimal strings exactly, including scientific notation, and truncate fractions toward zero: toInteger('9007199254740993.0') returns 9007199254740993. Invalid text and values outside the signed 64-bit range return null.
  • avg() ignores nulls, returns null for an empty group, and returns a float. A large total does not overflow while the inputs are finite. sum() reports integer overflow.
  • Expressions in RETURN or WITH without aggregates define the groups. In an expression that mixes aggregation with other operations, everything outside the aggregate’s arguments must be a constant, a parameter, a grouped variable, or a projected property, following the openCypher grouping rules. An ambiguous aggregation is rejected before anything runs.
  • ORDER BY can use an aggregate without returning it, as in RETURN 1 + sum(amount) AS total ORDER BY 2 - sum(amount).
  • A simple CASE value WHEN ... evaluates value once, and null never matches null; test for a missing value with CASE WHEN value IS NULL THEN .... Only the selected branch is evaluated, but aggregate arguments inside CASE are always evaluated.

Datetimes

A datetime is a UTC instant with millisecond precision, the same value native queries store from datetime literals, now(), and typed date_time parameters. Cypher reads those stored properties, at any depth in lists and maps, and CREATE and SET store datetimes back as datetimes. A list of datetimes, however it is written, is stored as one datetime list, which an equality index holds and an equality such as e.slots = [datetime('2026-06-01'), datetime('2026-06-02')] reads through it.
  • datetime() and timestamp() read the statement’s clock, once, before the statement is planned: every call in one statement, in a filter, a result or a write, returns the same instant, as a datetime or as integer epoch milliseconds. There is no duration; subtract milliseconds instead, as in datetime({epochMillis: timestamp() - 86400000}) for a day ago.
  • datetime(text) reads RFC 3339 (2026-06-01T09:00:00Z) with a Z or ±hh:mm offset, a date and time without an offset (read as UTC), or a date alone (2026-06-01, UTC midnight). Every field is zero-padded, years run from 0000 to 9999, in the text and in UTC once its offset applies, so 9999-12-31T23:59:59-00:01 is rejected, and seconds are required. A space may separate date and time; digits past milliseconds are dropped. datetime({epochMillis: n}) converts an integer, and a datetime or null passes through. datetimeOrNull(x) is datetime(x), except that a value it cannot read is null instead of an error, as toIntegerOrNull and the other …OrNull conversions are for theirs. requireDatetime(x) returns a datetime or null unchanged and fails with type_error for anything else.
  • Datetimes compare in time order. Against any type other than text, = is false and <, >, <=, >= are null, as for a string against a number. Against text, every comparison, IN, CASE match, and STARTS WITH, ENDS WITH, or CONTAINS is null, so it never matches; see below. ORDER BY places datetimes after paths and before strings. min, max, DISTINCT, and grouping work on datetimes; sum, avg, and arithmetic reject them.
  • Fields read UTC components as integers: dt.year, dt.quarter, dt.month, dt.week and dt.weekYear (ISO 8601 weeks, starting Monday), dt.day, dt.ordinalDay, dt.dayOfWeek (Monday is 1), dt.hour, dt.minute, dt.second, dt.millisecond, dt.epochSeconds, and dt.epochMillis. Use them to bucket or compute, such as b.at.epochMillis - a.at.epochMillis for a duration in milliseconds. Any other field is a type_error.
  • toString(dt) returns the same RFC 3339 text a result shows.
Literal text outside that grammar, such as an ISO week date, a time-zone name, or 2026-6-1, is rejected before anything runs (unsupported_feature, function). Literal text in the grammar’s form that names no instant, such as 2026-02-30 or a leap second, is rejected before anything runs with argument_error (invalid_datetime). Text that arrives at run time and does not read fails with argument_error (invalid_datetime). A stored instant outside years 0000–9999 compares and sorts, and a result renders it as native responses do (+10000-01-01T00:00:00.000Z), but datetime() does not read that text back; use datetime({epochMillis: n}). Past about 262,000 years from year 0, returning it, converting it to text, or reading a calendar field fails with argument_error (datetime_out_of_range), as a native response does. Text is never read as a datetime, so a datetime compared with text is null, as a comparison with null is, and never matches. A filter such as e.at > '2026-01-01', e.at = '2026-01-01T00:00:00Z', or e.at >= $since with a string parameter matches no node whose at is a datetime, and nor does e.at <> '…' or NOT e.at = '…'; read the text first with datetime('2026-01-01') or datetime($since), or compare toString(e.at) as text. The same holds at any depth inside lists and maps, for pattern properties such as {at: '…'}, and for joins and lookups that compare two stored values. Indexes never change the result: a scan, an equality or range index on the property, and an index on another property in the same WHERE all return the same rows. When both types are known before the query runs, it fails instead, with type_error (datetime_text_comparison). This applies to a comparison or text match (datetime() > '2026-01-01'), an IN member (datetime() IN ['2026-01-01']), and a simple CASE value against its subject (CASE datetime() WHEN '2026-01-01' THEN …). A parameter’s type is known from its bound value when the parameter is compared directly ($at = '…'), through a property of a map parameter ($obj.at), or through a variable set from either (WITH $at AS a). Each member of a list parameter is checked the same way, so datetime() IN $texts fails too. A written-out list or CASE that mixes datetimes and text fails even when an earlier member matches. Any other operand built from a parameter, such as UNWIND $dates AS d or coalesce($at, …), runs and compares as null. The store has no schema, so a SET of text, such as SET e.at = '2026-06-01T00:00:00Z', stores text even where the property otherwise holds datetimes. Comparisons over such a mixed property follow the same rule: a datetime matches only datetimes and text only text. Write SET e.at = datetime('…') to keep the property one type.

Indexes and performance

Cypher plans use existing native indexes automatically. You do not name an index in the statement; explain shows which one was chosen.
  • An equality on a labeled node, such as MATCH (u:User {email: $email}) or WHERE u.email = $email, can read an equality index. So can IN lists of up to 64 values and ORed equalities on one property.
  • A range such as WHERE u.age >= 21 AND u.age < $max can read a range index, and stops reading as soon as a LIMIT is satisfied.
  • ORDER BY on a range-indexed property in the index’s direction, with a range bound and a LIMIT, reads the index in order instead of sorting.
  • id(n) = $id and id(n) IN [7, 9, 12] (a literal list) read those nodes directly; a list parameter does not. See fetch many nodes.
  • An equality against an earlier variable, as in UNWIND $ids AS k MATCH (u:User {uid: k}), looks up the index once per row.
  • An expansion only reads the relationship types it names, so -[:WROTE|LIVES_IN]-> skips a node’s other relationships.
  • LIMIT stops scans and expansions early when the clauses before it cannot fail. Reading a stored property in RETURN can fail, so return whole nodes, or apply WITH ... LIMIT first and read properties afterwards: MATCH (u:User) WITH u LIMIT 10 RETURN u.name.
An index is only used when every other condition on that node cannot fail. Comparisons, string predicates, label and null tests, and their AND, OR, XOR, and NOT combinations over literals, parameters, variables, and properties qualify, as do datetime literals, typed datetime parameters, datetime($text) of a parameter that reads as a datetime, and the statement clock: datetime(), timestamp(), integer arithmetic over them, literals and parameters, and datetime({epochMillis: n}) of such an integer, so a recency filter such as WHERE e.at > datetime({epochMillis: timestamp() - $windowMs}) reads a range index. Arithmetic that would fail, such as an overflow, and other function calls keep the label scan, which raises the error.

Load and fetch in batches

Send many rows as one list parameter and UNWIND it. A request is one transaction, so each batch is written entirely or not at all:
Size each batch within the limits: the request body, query memory, and 200,000 values per parameter, where each list item, map, and map value counts (a three-property row counts four). Vector and text indexes also cap the queued index work per transaction (index_operation_batch_too_large). A few thousand small rows per request stays well inside them. Parallel batches can conflict; resend a 409 with retryable: true unchanged.

Fetch many nodes

Only a literal list of IDs reads nodes directly. A list parameter (id(n) IN $ids) or an ID from a variable (UNWIND $ids AS i MATCH (n) WHERE id(n) = i) scans the label, or every node when the pattern has no label. Write the IDs into the statement:
Build that list only from integers your code has checked, never from raw input. Each ID adds about two tokens to the statement’s 200,000-token budget. To fetch by an indexed property, UNWIND the keys; each row is one index lookup, at any list length:
WHERE u.email IN $emails reads the index too, but only for up to 64 values; a longer list scans the label.

Limits

AND, OR, and XOR chains count as one nesting level at any length; every other operator adds one, so a + b + c + ... fails at about 48 terms. Compute such values in the application and pass them as parameters. A statement that exceeds a budget fails with resource_limit (HTTP 429) instead of returning a truncated result, and a write that fails this way commits nothing. Reduce the work rather than retrying; see HTTP 429. UNWIND range(...) streams its values, while range() in an expression builds the whole list first.

Errors

A failed statement returns the Cypher error body:
error is the category and details.detail the specific condition, both in lower snake case. phase is compile (nothing ran) or runtime, and span gives the byte range of the statement text that failed, when known. Request, authentication, storage, and transaction failures use the native error envelope. The error reference lists every category with its HTTP status and retry guidance.

Next steps

HTTP API

Request headers, status codes, and the OpenAPI contract for the Cypher routes.

Error handling

Cypher error categories, HTTP statuses, and when to retry.

Reading data

The native read API, with Cypher equivalents.

Secondary indexes

Create the indexes that Cypher plans read.