Njord Analytics API

Summary

Njord Analytics is based on an API that powers every feature of the web app. It is possible to access this API for the purpose of automating tasks.

All API requests and responses are based on the GraphQL format specification. It is recommended to familiarize yourself with the query language and conventions of GraphQL to use the Njord Analytics API effectively.

You can access an interactive GraphQL API console at https://app.sailnjord.com/admin/graphql which allows you to:

  • Send GraphQL requests (queries and mutations) to the live API without any programming required

  • Browse the API documentation outlining all available queries and mutations and their input and output types (see "Documentation Explorer" symbol in the sidebar)

Note: All requests entered in this console are executed under your currently logged in user account, with all associated privileges and the ability to delete data if not careful (most mutations that delete data are clearly named "delete..." however). To avoid damage, send a simple query like { currentUser { name } } to confirm under which user name you are logged in, and consider using a test account without access to your real data if you want to be on the safe side.

The GraphQL API endpoint to send HTTP requests to when not using the console is https://api.prod.sailnjord.com/graphql

Authentication

Virtually all GraphQL queries and mutations require authorization in the form of an Authorization HTTP header sent with each HTTP request to the GraphQL API endpoint.

API Key

For many automated tasks that are tied to one specific user account, an API key or token that must be generated once is a suitable form of access control. To obtain an API key, send a GraphQL query like this from the interactive console (you may adjust the expiration date of the key to suit your needs):

{
  currentUser {
    name
    apiKey(expires: "2024-12-31T23:00Z") {
      authorization
      expires
    }
  }
}

The value of the authorization response field should be sent as the HTTP Authorization header with each GraphQL API request.

OAuth

For advanced use cases where different users require access to the Njord API, integration with Njord's OAuth identity provider is possible. Please contact us if you're interested.

Use Cases

To learn about useful queries and mutations, it can be helpful to inspect the API queries that the Njord Analytics web app performs - simply use the web development tools of your browser of choice, perform the desired task and inspect network requests and responses to the GraphQL API endpoint.

Examples are listed below. Feel free to contact us to get advice on further possibilities.