Company Data API Introduction

The Craft Company Data API is a GraphQL API build over HTTP and SSL.

GraphQL makes it possible to make a single API call to fetch all of the information on a particular company you need.

In order to make an API call, you need to send a POST request to the Company Data API endpoint:

POST https://api.craft.co/v1/query

In order to receive the GraphQL schema, you would do a POST request:

POST https://api.craft.co/v1/schema

A GraphQL POST request should use the application/json content type, have the x-craft-api-key header with your API Key in the value , and include a JSON-encoded body of the following form:

{
  "query": "...",
  "variables": { "myVariable": "someValue", ... }
}

In order to receive an API key please reach out to sales@craft.co

Query parameters should be sent as a JSON-encoded string in an additional query parameter called variables.

query is a required String parameter of the JSON body. An example would be:

query getCompany($domain: String!) {
    company(domain: $domain) {
        locations {
            city
            country
        }
    }
}

variables is a required JSON object parameter for most of the cases. An example would be:

{ "domain": "meta.com" }

Response

Regardless of the method by which the query and variables were sent, the response should be returned in the body of the request in JSON format.

A query might result in some data and some errors, and those should be returned in a JSON object of the form:

{
  "data": { ... },
  "errors": [ ... ]
}

If there were no errors returned, the "errors" field will not present on the response. Check out more details on errors.

Last updated