Example Queries
Change Your Region
Many of our distributor partners provide different inventory levels depending on the user's country. The API defaults to US and USD for country and currency but these can be overridden to get results more suitable to your region.
Compare the query for Great Britain:
query GBMatch {
supMultiMatch(
country: "GB"
currency: "GBP"
queries: [{ mpn: "AR 32 HZL-TT", limit: 3 }]
) {
parts {
sellers(authorizedOnly: true) {
company {
name
}
offers {
inventoryLevel
}
}
}
}
}
... with the query in the US:
query USMatch {
supMultiMatch(
queries: [{ mpn: "AR 32 HZL-TT", limit: 3 }]
) {
parts {
sellers(authorizedOnly: true) {
company {
name
}
offers {
inventoryLevel
}
}
}
}
}
In this case, on this particular day, there were 1,370 parts available to ship to GB. However, those in the US would only see 300 parts available.
Many distributors will ship to multiple countries or not segregate stock by country, and as such, the input country and currency are not used as a hard filter.
Country codes follow the ISO 3166 (alpha-2) standard; currency codes follow the ISO 4217 standard.
Exact mpn Match with Specific Suppliers
Using the SupMultiMatch query:
query MultiMatch {
supMultiMatch(
queries: [{mpn: "FH12-5S-1SH(55)", limit: 2}]
options: {filters: {distributor_id: ["459", "1106", "2401", "2628", "2454", "3261", "12947"]}}
) {
hits
parts {
mpn
name
sellers {
company {
name
}
offers {
prices {
price
currency
}
}
}
}
}
}
Note this will filter for parts sold by the specified distributor(s). The list of distributors is available here. If other distributors also sell this part, they will be listed too. You can always filter these out in your processing if desired.
Instead of the company ID, e.g. "459", you can specify the company name, e.g. "Digi-Key", instead. Here's an example:
query MultiMatch {
supMultiMatch(
queries: [{mpn: "FH12-5S-1SH(55)", limit: 2}]
options: {filters: {distributor_id: ["Digi-Key"]}}
) {
hits
parts {
mpn
name
sellers {
company {
name
}
offers {
prices {
price
currency
}
}
}
}
}
}
Parts from Sellers with Price Information
Here is a sample query you can use in your IDE:
query FindPrices {
supSearch(q: "AEC-Q100", limit: 3) {
results {
part {
mpn
manufacturer {
name
}
sellers(includeBrokers: false) {
company {
name
}
offers {
clickUrl
inventoryLevel
prices{
price
currency
quantity
}
}
}
}
}
}
}
Exact Part Match
The supMultiMatch query allows you to input multiple MPNs to retrieve data and looks for an exact match for each.
query MatchParts {
supMultiMatch(queries: [{mpn: "G3VM-101PR"}]) {
hits
reference
parts {
id
slug
mpn
manufacturer {
name
}
}
}
}
Filtering for In-stock Parts
When searching you can specify to only include parts which are in stock. For example:
supSearch(q: "LM339", limit: 1, inStockOnly: true) { ... }
Setting this filter to true means that parts are excluded that have no stock at all. If a part has inventory from just one distributor it is considered in-stock and returned as part of the query.
This filtering does not consider distributor stock at all – it applies at the part level.
Here is an example you can try. This query searches for AEC-Q100 with a pagination start page of 5, and inStockOnly set as true:
query in_stock_filter{
supSearch(q: "AEC-Q100", start: 5, inStockOnly: true) {
results {
part {
mpn
manufacturer {
name
}
sellers(includeBrokers: false) {
company {
name
}
}
}
}
}
}
Unexpected MPNs being Returned
When searching or matching sometimes additional parts are found where the MPNs differ only by non-alphanumeric characters, such as - or ..
For example, consider a supMultiMatch query for the following MPN:
query MultiMatch {
supMultiMatch(queries: {mpn: "ASV-18432MHZ-EJ-T", limit: 5}) {
hits
parts {
mpn
}
}
}
This may return multiple MPNs such as ASV-18.432MHZ-EJ-T as well as ASV-1.8432MHZ-E-J-T (and others).
This behavior is due to the way parts are "tokenized" for indexing in the elastic search engine.
MPNs are split into tokens, ignoring special characters (e.g., CV 3-200/SPG might become `CV`, `3200`, `SPG`).
Matching is then done using trigrams (three-letter combinations). The search must fully match a tokenized MPN, but partial matches depend on trigrams. For example:
-
Match: "CV 3-20", "CV 320", "00 SPG" - Each part aligns with at least one full token
-
No Match: "CV 3", "CV 3-", "CV 32" - No part of these aligns with any token
Using Wildcards
Sometimes, searching by partial part number returns too many parts, or you have specific requirements for part number matching. In these cases, you can use wildcards to refine your search.
-
The character
*matches any character sequence (including zero characters). -
The character
?matches any single character.
Wildcards can be used anywhere within a part number. Using wildcards to find the middle of a part number is unnecessary – leading and trailing wildcards are added automatically. For example, *74LS25* returns the same results as 74LS25.
If you add one or more wildcards to a term, no other wildcards are added automatically. This can be used to do prefix searches. For example, lv40 finds parts that contain lv40 anywhere in the part number, whereas lv40* finds only parts that start with lv40.
Factory Lead Time for Parts
There are two fields you can query in the API.
-
factoryLeadDaysonSupOfferreturns the number of days to acquire parts from the factory. -
estimatedFactoryLeadDaysonSupPartreturns the estimated factory lead time in days derived from trusted distributor offers.
Here's an example query for authorized sellers:
query LeadDaysSearch {
supSearch(q: "IRL3803STRLPBF", limit: 2) {
results {
part {
mpn
estimatedFactoryLeadDays
sellers(authorizedOnly: true) {
offers {
factoryLeadDays
}
}
}
}
}
}
Similar Parts
When searching or matching parts, you can specify to return similarParts. These are parts identified by Nexar to be similar in specification and functionality. Here's an example query:
query SimilarParts {
supSearch(q: "LM339MX", limit: 1) {
hits
results {
part {
id
mpn
name
manufacturer { name }
similarParts {
id
mpn
manufacturer { name }
}
}
}
}
}