The Neo4j GraphQL Library provides the following directives to be used whilst defining types:

Database mapping

Directive Description


Configures relationships between object types.


Required to differentiate interfaces that are used for relationship properties, and otherwise.


Specifies the configuration of a GraphQL object type which represents a Neo4j node.


Maps a GraphQL schema field to a Neo4j property on a node or relationship.


Configure relationships to be implemented on object types.


Directive Description


Requires authentication checks when accessing the type.


Specifies authorization rules for queries and mutations on the type.


Configures the JWT authentication and authorization filters to include additional JWT claims.


Used in combination with @jwt. Configures the JWT authentication and authorization filters to include an additional JWT claim which is either nested or using special characters not supported by GraphQL.


Specifies authorization rules for subscriptions on the type.


Directive Description


Marks a field as the unique ID for an object type, and allows for autogeneration of IDs.


Flags fields to be used to store timestamps on create and update events.

Schema configuration

Directive Description


Limits the availability of query operations in the library.


Limits the availability of Mutation operations in the library.


Limits subscription operations in the library.


Allows the setting of a default value for a field during object creation.


Redefines how to compose the plural of the type for the generated operations. Particularly useful for types that are not correctly pluralized or are non-English words.


Sets the availability of fields on queries and aggregations.


Sets the availability of fields on the create and update inputs.


Defines the filters generated for a field.

Indexes and constraints

Directive Description


Indicates that there should be a fulltext index inserted into the database for the specified Node and its properties.


Indicates that there should be a uniqueness constraint in the database for the fields that it is applied to.


Perform a vector index search on your database either based by passing in a vector index or a search phrase. Beta

Custom logic

Directive Description


Overrides field resolution (including query and mutation fields), instead resolving with the specified Cypher.


Exposes a mechanism for querying against non-existent, null values on a node.


Used on nodes to inject values into Cypher LIMIT clauses.


Specifies that a field is resolved by a custom resolver, and allows the specification of any required fields that is passed as arguments to the custom resolver.


Specifies a callback function (executed during GraphQL query parsing) to populate fields which have not been provided within the input.


Directive Description


Protects fields which should only be available through the OGM.


Directive Description


Specifies that the field should be used as the global node identifier for Relay.