Je hebt Javascript nodig om deze website te kunnen gebruiken. Pas je browserinstellingen in om verder te gaan!
Data model

Type Definitions

Choose a practical strategy for type-safe API responses.

We do not currently publish a first-class API type package. Choose one of these approaches when your project needs strict response types.

Define project-specific types

Define your own types based on the expected API responses. This approach gives you full control over:

  • Naming conventions
  • Optional vs. required fields
  • Nested object structures
  • Field transformations applied in your application

Use the API responses and schema definitions as the source of truth when modeling your types.

Choose this when you need clean, maintainable types tailored to your application.

Start from our example schema

Copy and paste the type schema from our code snippets repository. We maintain and update these definitions regularly to reflect changes in the API schema.

Choose this when you want a fast starting point with minimal setup.
The example schema includes types you may not be allowed to read. Your available data still depends on your permissions.

Generate types from OpenAPI

You can generate types automatically from our OpenAPI specification using standard OpenAPI tooling.

However, be aware that:

  • The generated types may be verbose.
  • The structure may not be idiomatic for your language.
  • Some definitions may be difficult to use directly.

This is due to how Directus generates its OpenAPI specification, which prioritizes completeness over developer ergonomics.

Choose this when automated schema synchronisation matters and you can refine generated output.

Keep in touch with the latest

Sign up for our monthly deep dives - straight to your inbox.