Skip to main content

Endless API

The Endless API lets your software work with the products, inventory, orders, purchasing, and fulfillment data in Endless. Use it to connect another system, build internal tools, or bring your commerce data into reports.

The API uses GraphQL. You describe the data you need or the action you want to perform, send a request, and receive a JSON response.

What you can build​

Start with the custom integration that matches your workflow. Each integration has permissions for the data and actions it needs.

Your workflowIntegration
Read data for reports, dashboards, or a data warehouseCustom Data Integration, with read-only access
Maintain a catalog from a PIM, ERP, or another product systemCustom Product Integration
Bring orders into Endless from a sales channel or another order sourceCustom Sales Integration
Connect a warehouse or fulfillment providerCustom Fulfillment Integration

How the API works​

All requests go to one GraphQL endpoint. The operation in your request determines what happens:

  • A query reads data, such as a product or a page of inventory records.
  • A mutation changes data or performs an action, such as creating an order.
  • The schema defines the available operations, their inputs, and the fields they can return. The reference in the sidebar is generated from this schema.

You choose the fields to return, including fields on related records. For example, this query asks for two products and only their IDs, names, and SKUs:

query FirstProducts {
products(first: 2) {
nodes {
id
name
sku
}
}
}

The response follows the same structure, inside a data object. nodes contains the product records. Requesting another field adds that field to the response.

Company access and permissions​

Requests run with the permissions of the integration or signed-in user. Set the X-Company-Id header to identify the company you want to work with, using its Endless ID or handle. The credentials must have access to that company.

An operation appearing in the reference does not mean every integration can use it. For example, a Custom Data Integration can read data but cannot run mutations that change it. Choose an integration with permissions for your workflow.

Connect to Endless​

Choose an endpoint​

Send requests as HTTP POST with a JSON body to the endpoint for your environment.

EnvironmentEndpoint
Productionhttps://api.endlesscommerce.com/graphql
Sandboxhttps://api-sandbox.endlesscommerce.com/graphql

Use the credentials and company details for the environment you are connecting to.

Authenticate your integration​

Create a custom integration using one of the setup guides above. Use its access token in the X-EC-Access-Token header, without a Bearer prefix. This does not require a user sign-in step.

Include these headers with your data requests:

HeaderValue
Content-Typeapplication/json
X-EC-Access-TokenYour integration’s access token
X-Company-IdYour Endless company ID or handle

Keep the access token in your server or data platform’s secret storage. Do not include it in public browser code or commit it to source control.

Using a user session instead

The API also accepts a user session token. Use the signIn mutation to obtain the token and its expiration time:

curl --request POST \
--url https://api.endlesscommerce.com/graphql \
--header 'Content-Type: application/json' \
--data '{
"query": "mutation { signIn(input: { loginIdentifier: \"your@email\", password: \"your-password\" }) { token tokenExpiration } }"
}'

Use the returned token in Authorization: Bearer YOUR_TOKEN instead of X-EC-Access-Token. Keep the X-Company-Id header for company data requests. When the session expires, sign in again.

The me query returns the signed-in user:

curl --request POST \
--url https://api.endlesscommerce.com/graphql \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_TOKEN' \
--data '{"query":"{ me { id firstName lastName } }"}'

Make your first request​

With an integration that can read products, send the query from above:

curl --request POST \
--url https://api.endlesscommerce.com/graphql \
--header 'Content-Type: application/json' \
--header 'X-EC-Access-Token: YOUR_ACCESS_TOKEN' \
--header 'X-Company-Id: YOUR_COMPANY_ID' \
--data '{"query":"query FirstProducts { products(first: 2) { nodes { id name sku } } }"}'

Replace the token and company placeholders with your credentials. A successful response contains data.products.nodes, with up to two products from your company. An empty nodes array means the query did not find any products.

Pass values as variables​

Keep changing values, such as a product ID, in a separate variables object. This lets you reuse an operation without building query strings from user input.

The following JSON request body retrieves one product. Replace YOUR_PRODUCT_ID with an ID returned by your first request:

{
"query": "query GetProduct($id: ID!) { product(id: $id) { id name sku } }",
"variables": {
"id": "YOUR_PRODUCT_ID"
}
}

Read more than one page​

Queries that return a connection, such as products, support pagination. Request pageInfo alongside nodes to find out whether more results are available:

query ProductPage($after: String) {
products(first: 25, after: $after) {
nodes {
id
name
sku
}
pageInfo {
hasNextPage
endCursor
}
}
}

Start without an after value. If hasNextPage is true, pass endCursor as the after variable in the next request. Repeat until hasNextPage is false. Check each query’s reference for its supported filters and pagination arguments.

Check for errors​

A GraphQL response can contain data, errors, or both. Check the errors array even when the HTTP status is 200; some requests can return partial data alongside an error.

ProblemWhat to check
Authentication failsConfirm the access token or session token and the environment.
Company context is missingInclude X-Company-Id with your company ID or handle.
An operation is deniedConfirm the integration or user has permission for that operation.
A field or argument is rejectedCompare the request with the current schema in the reference.

Find your next operation​

The sidebar groups the reference by area of Endless. Within each area, queries describe what you can read, mutations describe what you can change, and objects describe the returned data. Follow the linked input types to see what a mutation accepts.

Start with the products query, inventory query, or product object. Each operation lists its arguments and return type. In a type such as ID!, the ! means the value cannot be null; for an input, it must be supplied unless it has a default. Square brackets mark a list of values.

To try queries in your browser, open GraphiQL at https://app.endlesscommerce.com/YOUR_COMPANY_HANDLE/graphiql while signed in. For more on GraphQL syntax, see the GraphQL guide.

Follow the developer changelog for breaking changes and changes to API behavior. For help with access or an API problem, email support@endlesscommerce.com.