Search
The Octopart API provides three queries for finding parts. Choosing the right one depends on what you know about the part you're looking for.
Query |
Use when... |
|
You have one or more exact MPNs or SKUs and want a precise match for each |
|
You have a single MPN and want ranked MPN-match results |
|
You're searching by keyword, description, or partial part number |
MPN Matching
supMultiMatch – Batch Exact Match
supMultiMatch accepts a list of MPNs or SKUs and returns the best match for each. It is the right choice when you know the part numbers and need to look up multiple parts in a single request.
query MatchParts {
supMultiMatch(queries: [{ mpn: "LM358DR" }, { mpn: "LM339MX" }]) {
hits
parts {
mpn
manufacturer {
name
}
sellers {
company {
name
}
offers {
inventoryLevel
prices {
price
currency
quantity
}
}
}
}
}
}
Each element in queries can include its own limit to control how many matched parts are returned for that MPN.
supSearchMpn – Single MPN Search
supSearchMpn takes a single query string and returns ranked MPN-match results. Use it when searching for one part at a time.
query FindByMpn {
supSearchMpn(q: "LM358", limit: 5) {
hits
results {
part {
mpn
manufacturer {
name
}
}
}
}
}
Keyword Search
supSearch performs a broader search across part descriptions, specifications, and categories. Use it when you don't have an exact MPN – for example, when searching by component type and electrical characteristics.
query FindCapacitors {
supSearch(q: "100nF 50V 0402 ceramic", limit: 3) {
hits
results {
part {
mpn
shortDescription
manufacturer {
name
}
sellers(includeBrokers: false) {
company {
name
}
offers {
clickUrl
inventoryLevel
prices {
price
currency
quantity
}
}
}
}
}
}
}
The q string is matched against part descriptions, categories, and indexed attributes. For attribute-based filtering (e.g. exact capacitance or voltage rating), use the filters parameter – see available filter attributes.
Filtering Results
In-stock Filter
Pass inStockOnly: true to exclude parts that have no stock at any distributor. The filter applies at the part level – a part with stock at even one distributor is considered in stock.
supSearch(q: "LM339", limit: 10, inStockOnly: true) { ... }
Authorized Sellers Only
Pass authorizedOnly: true on the sellers field to return only authorized distributors, excluding brokers and grey-market sellers.
sellers(authorizedOnly: true) {
company { name }
offers { inventoryLevel }
}
Filter by Distributor
Use options.filters.distributor_id to scope results to specific distributors. You can pass either the distributor's numeric ID or its name:
query MultiMatch {
supMultiMatch(
queries: [{ mpn: "FH12-5S-1SH(55)", limit: 2 }]
options: { filters: { distributor_id: ["Digi-Key", "Mouser"] } }
) {
hits
parts {
mpn
sellers {
company { name }
offers {
prices { price currency }
}
}
}
}
}
The full list of distributor IDs is available at octopart.com/api/v4/values.
Region and Currency
Many distributors provide different inventory levels depending on the buyer's country. The API defaults to US and USD if country and currency are not specified.
Pass country and currency at the query level to get region-appropriate results:
query GBMatch {
supMultiMatch(
country: "GB"
currency: "GBP"
queries: [{ mpn: "LM358DR", limit: 3 }]
) {
parts {
sellers(authorizedOnly: true) {
company { name }
offers { inventoryLevel }
}
}
}
}
Country codes follow ISO 3166 alpha-2; currency codes follow ISO 4217.
Note that many distributors ship to multiple countries or do not segregate stock by country, so country and currency are not a hard filter – they influence which offers are surfaced and their pricing.
Wildcards
When partial part number matching returns too many results, wildcards let you narrow the search:
Wildcard |
Matches |
|
Any character sequence (including empty) |
|
Any single character |
By default, leading and trailing wildcards are added automatically – so 74LS25 and *74LS25* return the same results.
If you add any wildcard explicitly, automatic wildcards are not added. This is useful for prefix searches:
lv40 → matches anything containing "lv40" (wildcards added automatically) lv40* → matches only parts starting with "lv40"
Unexpected MPNs in Results
When using MPN matching, you may occasionally receive parts whose MPNs look different from the one you searched for. This is expected behavior caused by how the search engine tokenizes and indexes part numbers.
Non-alphanumeric characters (such as - and .) are ignored when building the search index. Matching is then done using trigrams (three-character sequences). For example, searching for ASV-18432MHZ-EJ-T may also return ASV-18.432MHZ-EJ-T because both tokenize to the same set of trigrams.
If an exact character match is required, compare the returned MPNs against your input and filter the results in your application.
Key Response Fields
Field |
Location |
Description |
|
|
Manufacturer part number |
|
|
Manufacturer name |
|
|
List of sellers with offers |
|
|
Distributor or broker name |
|
|
Stock quantity (see Inventory for special codes) |
|
|
Tiered price breaks with |
|
|
Direct link to the offer on the distributor's site |
|
|
Days to acquire from factory, per distributor offer |
|
|
Estimated factory lead time derived from trusted distributor offers |
|
|
Functionally equivalent alternative parts |