Quickstart
This guide walks through authenticating with the DigiKey API and making a product search request. From start to first successful response takes about 10 minutes.
Step 1 — Create an application
- Go to developer.digikey.com and sign in or register.
- Navigate to My Apps and click + Create App.
- Fill in a name and description, then click Save.
- On the application page, copy your Client ID and Client Secret.
Keep the Client Secret private. Do not include it in client-side code or commit it to source control.
Step 2 — Subscribe to an API product
Your application must be subscribed to each API product you want to call.
- Go to developer.digikey.com/products.
- Click the product you need (start with Product Information v4).
- Click Subscribe and select your application.
A 403 Forbidden response means your application is not subscribed to that product.
Step 3 — Get an access token
Product Information v4 uses the 2-legged (Client Credentials) flow.
curl -X POST https://api.digikey.com/v1/oauth2/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET"
Response:
{
"access_token": "eyJhbGciOiJSUzI1NiIs...",
"token_type": "Bearer",
"expires_in": 1800
}
Save the access_token. It expires in 1800 seconds (30 minutes).
Step 4 — Search for a product
curl -X POST https://api.digikey.com/products/v4/search/keyword \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "X-DIGIKEY-Client-Id: YOUR_CLIENT_ID" \
-H "Content-Type: application/json" \
-d '{"Keywords": "STM32F103C8T6", "Limit": 5}'
Successful response (truncated):
{
"Products": [
{
"DigiKeyPartNumber": "497-6063-ND",
"ManufacturerProductNumber": "STM32F103C8T6",
"Manufacturer": { "Id": 497, "Name": "STMicroelectronics" },
"Description": {
"ProductDescription": "IC MCU 32BIT 64KB FLASH 48LQFP"
},
"UnitPrice": 5.91,
"QuantityAvailable": 4215,
"ProductStatus": { "Id": 0, "Status": "Active" }
}
],
"ProductsCount": 3
}
Step 5 — Get full product detail
Use the DigiKey part number returned from search to fetch complete product data:
curl "https://api.digikey.com/products/v4/search/497-6063-ND/productdetails" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "X-DIGIKEY-Client-Id: YOUR_CLIENT_ID"
OAuth 2.0 redirect setup (3-legged APIs)
For APIs that require user authorization (Ordering, MyLists, Barcode, etc.), you need to register a redirect URI in your application settings.
- In your app settings at developer.digikey.com/user/apps, add your redirect URI to OAuth Callback / Redirect URIs.
- When running the portal locally:
http://localhost:3000/ - For production deployments: use your actual domain, e.g.
https://yourapp.com/callback
The redirect URI in your authorization request must match exactly what is registered. A mismatch causes a redirect_uri_mismatch error.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
401 Unauthorized |
Token expired or missing | Re-request a token |
401 with "The Bearer token is invalid" |
Wrong token type or tampered token | Re-authenticate from scratch |
403 Forbidden |
App not subscribed to the API | Subscribe at developer.digikey.com/products |
400 Bad Request |
Missing or invalid parameter | Read ErrorDetails in the response body |
429 Too Many Requests |
Rate limit hit | Wait for the number of seconds in Retry-After |
redirect_uri_mismatch during OAuth |
URI not registered | Add the exact URI to your app's OAuth settings |