Octopart API Quick Start Guide

The Octopart API is a GraphQL API for electronic component supply chain data. It gives you programmatic access to the Octopart database – parts, pricing, inventory levels, distributor offers, factory lead times, and more – across millions of components from thousands of manufacturers and distributors worldwide.

This guide gets you from zero to your first Octopart API query in minutes.

Prerequisites

An account on Altium Developer Center – Altium's self-service portal for developers, where you can enroll in programs to access Altium 365 API, Octopart API, Altium Designer SDK, Embeddable Viewer, and other developer products

Step 1: Get Credentials

  1. Sign in to portal.nexar.com.

  2. Create a new application.

  3. Copy the Client ID and Client Secret – you'll need both to request a token.

Your Client Secret is shown once. Store it securely before leaving the page.

Step 2: Get an Access Token

Exchange your credentials for an access token using the OAuth 2.0 client_credentials grant:

curl -X POST https://identity.nexar.com/connect/token \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "grant_type=client_credentials" \
  -d "client_id=CLIENT_ID" \
  -d "client_secret=CLIENT_SECRET" \
  -d "scope=supply.domain"

A successful response looks like this:

{
  "access_token": "eyJhbGci...",
  "expires_in": 86400,
  "token_type": "Bearer"
}

Copy the access_token value. Tokens expire after one hour – see Authentication for how to handle token refresh in your application.

Step 3: Run Your First Query

Send a GraphQL query to the endpoint using your token in the Authorization header:

curl -X POST https://api.nexar.com/graphql \
  -H "Authorization: Bearer ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "query { supSearchMpn(q: \"LM358\", limit: 3) { hits results { part { mpn manufacturer { name } } } } }"
  }'

A successful response returns matched parts:

{
  "data": {
    "supSearchMpn": {
      "hits": 42,
      "results": [
        {
          "part": {
            "mpn": "LM358DR",
            "manufacturer": { "name": "Texas Instruments" }
          }
        }
      ]
    }
  }
}

The hits field shows how many parts matched. Use limit and start to page through results – see Pagination in Octopart API.

Try it in the Browser

You can run and explore queries interactively in the Nitro IDE, available directly at the GraphQL endpoint:

https://api.nexar.com/graphql

To explore the schema visually, open the Voyager browser:

https://api.nexar.com/ui/voyager

Next Steps

  • Authorization – token expiry, re-requesting tokens, and managing credentials

  • Search – MPN matching, keyword search, filters, region and currency

  • Example Queries – ready-to-run queries for common use cases

 

如您发现任何问题,请选中相关文本/图片,并按 Ctrl + Enter 键向我们提交反馈。
Content