Home / Basics / Highnote API

Using the Highnote API

Before you start

This guide uses a simple cURL command to demonstrate how to query the Highnote API. It sends a ping query to the Highnote API where \ represents a newline:

You can also use the short single-dash options:

If successful, it returns the following JSON payload:

Headers

The Highnote API requires the following headers:

  • Content-Type
  • Authorization

Content type

Because the Highnote API accepts and returns JSON, you must pass a Content-Type header with the value of application/json:

Authorization

Highnote API requests are authenticated with Basic auth. Basic auth sets your API Key as the username and does not require a password.

  1. Create an API key in the Dashboard. See Creating and Managing API Keys.

  2. Convert your API key, which is in ASCII format, to base64:

  3. Make a request by passing the Authorization header with the Basic scheme and your base64 encoded API key:

Requests with missing or invalid credentials return a 401 Unauthorized response code.

Request body

The Highnote API accepts POST requests with JSON payloads. Requests must contain a string named query, but can also contain variables and operationName.

In our ping query example, the request body is on line 4 -- Ping is the operation name and ping is the actual GraphQL field being queried:

Our cURL command is making the following GraphQL call:

Ping

Request with variables

To make a more complex call using variables, try requesting a list of your first 10 API keys:

Request URL

Our example ping query has a request URL on line 5.

Request URLs used for the Highnote API differ depending on whether you use the live or test environments. The live and test environment both use a graphql endpoint, with a different subdomain.

Note: To output the response in pretty colorized JSON format, you can install jq and edit the URL in your cURL command as follows: https://api.us.test.highnote.com/graphql | jq -C '.'

Test Environment Request URL
Live Environment Request URL

Status codes

Unlike REST, GraphQL often returns a 200 OK status code even when there are errors. For error handling, the response includes an errors object with detailed information for troubleshooting. For mutations, request the userError type on the union type for specific details about the failure. See error handling for more information.

There are a few non 200 status codes that Highnote’s GraphQL API returns for the following cases:

Status CodeScenario
200 OKGraphQL request was successful or validation/logic errors occurred. See error handling for more information.
400 Bad RequestGraphQL validation failed. This is generally because of malformed input or selection sets. In this case, the errors collection will be on the response body.
401 UnauthorizedReturned when invalid credentials are present.
5xxSomething is wrong on the Highnote side.

Response body

Read more about GraphQL responses and formats in the spec.

The response body of a query contains the data requested from the API endpoint. The Highnote API returns JSON response bodies. A response body contains the following:

Response BodyDescription
dataThe result of the given operation(s). This data will reflect the shape of your selection on the query.
errorsThe errors collection will be present if the GraphQL engine failed to parse or validate the given request.
extensionsThe extensions field is a map of data custom to a GraphQL implementation. For the Highnote API, the extensions field will contain a requestId for use in debugging or support scenarios.

For help, see Troubleshooting with request ID.

Provide Feedback

Was this content helpful?