{"openapi":"3.1.0","info":{"title":"DealHunter Query API","version":"1.0.0","description":"Read-only access to your own DealHunter saved searches and the matches they find. Poll `GET /v1/matches` with the `next_cursor` from the previous response, wait `Poll-Interval` seconds between polls, and send `If-None-Match` to get a `304` when nothing is new. Within v1, fields and values are only ever added: ignore fields you do not know and treat an unknown value as `unknown`."},"security":[{"bearerAuth":[]}],"paths":{"/v1/me":{"get":{"operationId":"getMe","summary":"The calling key's status","responses":{"200":{"description":"Key and account status.","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Me"}}}},"401":{"$ref":"#/components/responses/InvalidKey"},"403":{"$ref":"#/components/responses/PlanRequired"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/Internal"},"503":{"$ref":"#/components/responses/Unavailable"}}}},"/v1/searches":{"get":{"operationId":"listSearches","summary":"All of your saved searches (at most 200)","parameters":[{"$ref":"#/components/parameters/IfNoneMatch"}],"responses":{"200":{"description":"Your saved searches.","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"Poll-Interval":{"$ref":"#/components/headers/Poll-Interval"},"ETag":{"$ref":"#/components/headers/ETag"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchList"}}}},"304":{"description":"Nothing changed since the ETag you sent in `If-None-Match`. No body.","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"Poll-Interval":{"$ref":"#/components/headers/Poll-Interval"},"ETag":{"$ref":"#/components/headers/ETag"}}},"401":{"$ref":"#/components/responses/InvalidKey"},"403":{"$ref":"#/components/responses/PlanRequired"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/Internal"},"503":{"$ref":"#/components/responses/Unavailable"}}}},"/v1/searches/{id}":{"get":{"operationId":"getSearch","summary":"One saved search","parameters":[{"name":"id","in":"path","required":true,"description":"Saved-search id (`ss_…`).","schema":{"$ref":"#/components/schemas/SearchId"}}],"responses":{"200":{"description":"The saved search.","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Search"}}}},"400":{"$ref":"#/components/responses/InvalidParameter"},"401":{"$ref":"#/components/responses/InvalidKey"},"403":{"$ref":"#/components/responses/PlanRequired"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/Internal"},"503":{"$ref":"#/components/responses/Unavailable"}}}},"/v1/matches":{"get":{"operationId":"listMatches","summary":"Matches newer than a cursor, oldest first","parameters":[{"name":"cursor","in":"query","required":false,"description":"`next_cursor` from your previous response. Omit to start from the oldest retained match.","schema":{"type":"string"}},{"name":"search_id","in":"query","required":false,"description":"Only matches from this saved search.","schema":{"$ref":"#/components/schemas/SearchId"}},{"name":"limit","in":"query","required":false,"description":"Page size.","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"$ref":"#/components/parameters/IfNoneMatch"}],"responses":{"200":{"description":"A page of matches. `data` is empty when nothing is new.","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"Poll-Interval":{"$ref":"#/components/headers/Poll-Interval"},"ETag":{"$ref":"#/components/headers/ETag"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MatchList"}}}},"304":{"description":"Nothing changed since the ETag you sent in `If-None-Match`. No body.","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"Poll-Interval":{"$ref":"#/components/headers/Poll-Interval"},"ETag":{"$ref":"#/components/headers/ETag"}}},"400":{"$ref":"#/components/responses/InvalidParameter"},"401":{"$ref":"#/components/responses/InvalidKey"},"403":{"$ref":"#/components/responses/PlanRequired"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/Internal"},"503":{"$ref":"#/components/responses/Unavailable"}}}},"/v1/matches/{id}":{"get":{"operationId":"getMatch","summary":"One match","parameters":[{"name":"id","in":"path","required":true,"description":"Match id (`mt_…`).","schema":{"$ref":"#/components/schemas/MatchId"}}],"responses":{"200":{"description":"The match.","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Match"}}}},"400":{"$ref":"#/components/responses/InvalidParameter"},"401":{"$ref":"#/components/responses/InvalidKey"},"403":{"$ref":"#/components/responses/PlanRequired"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/Internal"},"503":{"$ref":"#/components/responses/Unavailable"}}}},"/v1/openapi.json":{"get":{"operationId":"getOpenApi","summary":"This document","security":[],"responses":{"200":{"description":"The OpenAPI 3.1 document.","content":{"application/json":{"schema":{"type":"object"}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"`Authorization: Bearer dh_live_…`"}},"parameters":{"IfNoneMatch":{"name":"If-None-Match","in":"header","required":false,"description":"The `ETag` from your previous response. Unchanged -> `304 Not Modified`.","schema":{"type":"string"}}},"headers":{"Request-Id":{"description":"Unique id for this request. Quote it when contacting support.","schema":{"type":"string"}},"RateLimit-Policy":{"description":"The account's rate limit: `\"per_account\";q=10;w=60` (10 requests per 60 seconds, shared by all of the account's keys; IETF draft-ietf-httpapi-ratelimit-headers). Over it: 429 `rate_limited` with `Retry-After`.","schema":{"type":"string"}},"Poll-Interval":{"description":"Minimum seconds to wait before the next poll. Always use the latest value. Does not apply between pages while `has_more` is true.","schema":{"type":"integer","minimum":1}},"ETag":{"description":"Weak validator for this response. Send it back as `If-None-Match`.","schema":{"type":"string"}},"Retry-After":{"description":"Seconds to wait before retrying.","schema":{"type":"integer","minimum":0}}},"responses":{"InvalidParameter":{"description":"`invalid_parameter`: a bad cursor, an out-of-range limit or a malformed id.","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"InvalidKey":{"description":"`invalid_key`: the key is missing, malformed, unknown or revoked.","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"PlanRequired":{"description":"`plan_required`: the key is valid but the account is no longer on an eligible plan.","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"NotFound":{"description":"`not_found`: no such id for this key. The same answer whether it does not exist or is someone else's.","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"RateLimited":{"description":"`rate_limited`: over the account's limit of 10 requests per minute. Wait `Retry-After` seconds.","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"},"Retry-After":{"$ref":"#/components/headers/Retry-After"}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"Internal":{"description":"`internal`: an unexpected error on our side. Quote `request_id` if you contact support; retrying with backoff is safe.","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"Unavailable":{"description":"`unavailable`: temporarily unable to serve. Safe to retry with backoff.","headers":{"Request-Id":{"$ref":"#/components/headers/Request-Id"},"RateLimit-Policy":{"$ref":"#/components/headers/RateLimit-Policy"}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}},"schemas":{"BuyingFormat":{"type":"string","description":"How the listing is sold. `best_offer` is a buy-now price the seller will also negotiate. Extensible.","x-extensible-enum":["fixed_price","auction","best_offer","unknown"],"examples":["fixed_price","auction","best_offer","unknown"]},"Condition":{"type":"string","description":"Item condition, normalised across marketplaces. `unknown` when the marketplace gives none or gives a value we do not map. Extensible.","x-extensible-enum":["new","new_other","like_new","good","fair","poor","refurbished","for_parts","unknown"],"examples":["new","new_other","like_new","good","fair","poor","refurbished","for_parts","unknown"]},"Delivery":{"type":"string","description":"How the buyer gets the item. Extensible.","x-extensible-enum":["shipping","local_pickup","shipping_or_pickup","unknown"],"examples":["shipping","local_pickup","shipping_or_pickup","unknown"]},"ErrorCode":{"type":"string","description":"Stable machine-readable error code. Branch on this, not on `title`. Extensible.","x-extensible-enum":["invalid_parameter","invalid_key","plan_required","not_found","rate_limited","unavailable","internal"],"examples":["invalid_parameter","invalid_key","plan_required","not_found","rate_limited","unavailable","internal"]},"ItemLocation":{"type":"object","properties":{"city":{"anyOf":[{"type":"string","minLength":1,"maxLength":100,"pattern":"^[^A-Z]*$"},{"type":"null"}]},"region":{"anyOf":[{"type":"string","pattern":"^[a-z]{1,3}$"},{"type":"null"}]},"country":{"anyOf":[{"type":"string","pattern":"^[a-z]{2}$"},{"type":"null"}]}},"required":["city","region","country"],"description":"Where the item is, at city level at most. Never the seller's address or coordinates. `region` is a state or province code (`tx`) and `country` an ISO 3166-1 alpha-2 code (`us`), both lowercase."},"Marketplace":{"type":"string","description":"Marketplace id. Extensible: new marketplaces may appear, so treat an unrecognised value as unknown.","x-extensible-enum":["offerup","mercari","facebook","poshmark","craigslist","ebay","depop","vinted","whatnot","autotrader"],"examples":["offerup","mercari","facebook","poshmark","craigslist","ebay","depop","vinted","whatnot","autotrader"]},"Match":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/MatchId"},"search_id":{"$ref":"#/components/schemas/SearchId"},"search_name":{"type":"string","pattern":"^[^A-Z]*$","description":"The saved search's name when the match was found."},"marketplace":{"$ref":"#/components/schemas/Marketplace"},"title":{"type":"string","maxLength":300,"pattern":"^[^A-Z]*$"},"asking_price":{"description":"Asking price. For an auction, the current bid when found.","$ref":"#/components/schemas/Money"},"buying_format":{"$ref":"#/components/schemas/BuyingFormat"},"url":{"type":"string","format":"uri","description":"The listing on the marketplace."},"image_url":{"anyOf":[{"type":"string","format":"uri"},{"type":"null"}],"description":"First listing image."},"item_condition":{"$ref":"#/components/schemas/Condition"},"condition_label":{"anyOf":[{"type":"string","minLength":1,"maxLength":60,"pattern":"^[^A-Z]*$"},{"type":"null"}],"description":"The marketplace's own condition wording, lowercase (`pre-owned`, `used - like new`, `very good`). `null` when the marketplace gives none. `item_condition` is the normalised value to filter on."},"delivery":{"$ref":"#/components/schemas/Delivery"},"shipping_price":{"anyOf":[{"$ref":"#/components/schemas/Money"},{"type":"null"}],"description":"`null` when unknown. An amount of 0 means free shipping."},"item_location":{"anyOf":[{"$ref":"#/components/schemas/ItemLocation"},{"type":"null"}]},"listed_at":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"},{"type":"null"}],"description":"When the seller posted the listing. `null` unless the marketplace reports it reliably."},"found_at":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$","description":"When DealHunter found the listing."}},"required":["id","search_id","search_name","marketplace","title","asking_price","buying_format","url","image_url","item_condition","condition_label","delivery","shipping_price","item_location","listed_at","found_at"],"description":"A listing that matched one of your saved searches."},"MatchId":{"type":"string","pattern":"^mt_[0-9a-hjkmnp-tv-z]{26}$","description":"Opaque, stable match id (`mt_` + 26 characters). Use it to de-duplicate."},"MatchList":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Match"}},"next_cursor":{"type":"string","minLength":1,"description":"Pass back as `cursor` on the next request. Opaque: do not parse it."},"has_more":{"type":"boolean","description":"`true` when more matches are waiting: fetch the next page straight away."}},"required":["data","next_cursor","has_more"]},"Me":{"type":"object","properties":{"plan":{"$ref":"#/components/schemas/Plan"},"key_prefix":{"type":"string","minLength":1,"description":"The first characters of the key making this request."},"rate_limit":{"type":"object","properties":{"limit":{"type":"integer","minimum":1},"window_seconds":{"type":"integer","minimum":1}},"required":["limit","window_seconds"]},"retention_days":{"type":"integer","minimum":1,"description":"How many days of matches are kept."}},"required":["plan","key_prefix","rate_limit","retention_days"],"description":"The calling key and its account."},"Money":{"type":"object","properties":{"amount_cents":{"type":"integer","minimum":0},"currency":{"type":"string","pattern":"^[a-z]{3}$"}},"required":["amount_cents","currency"],"description":"An amount in the currency's minor unit (cents for `usd`) plus its ISO 4217 code in lowercase. Never a float."},"Plan":{"type":"string","description":"The account's plan. Extensible.","x-extensible-enum":["premium"],"examples":["premium"]},"Problem":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer","minimum":400,"maximum":599},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"$ref":"#/components/schemas/ErrorCode"},"request_id":{"type":"string"}},"required":["type","title","status","code","request_id"],"description":"RFC 9457 problem details, plus a stable `code`."},"Search":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/SearchId"},"name":{"type":"string","pattern":"^[^A-Z]*$"},"keyword_groups":{"type":"array","items":{"type":"string","pattern":"^[^A-Z]*$"},"description":"Required keyword groups: a listing must match every group. Alternatives inside one group are separated by `|`."},"excluded_keywords":{"type":"array","items":{"type":"string","pattern":"^[^A-Z]*$"},"description":"Listings containing any of these are skipped. Empty if none."},"marketplaces":{"type":"array","items":{"$ref":"#/components/schemas/Marketplace"},"description":"The marketplaces this search watches that the API publishes. A marketplace DealHunter is still rolling out is left out until it is published, so this list can be empty while the search only watches such a marketplace; it fills in, and its matches appear, once that marketplace is published."},"price_min":{"anyOf":[{"$ref":"#/components/schemas/Money"},{"type":"null"}]},"price_max":{"anyOf":[{"$ref":"#/components/schemas/Money"},{"type":"null"}]},"search_area":{"anyOf":[{"$ref":"#/components/schemas/SearchArea"},{"type":"null"}]},"status":{"$ref":"#/components/schemas/SearchStatus"},"created_at":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"},"updated_at":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"}},"required":["id","name","keyword_groups","excluded_keywords","marketplaces","price_min","price_max","search_area","status","created_at","updated_at"],"description":"One of your saved searches."},"SearchArea":{"type":"object","properties":{"postal_code":{"type":"string","pattern":"^[a-z0-9][a-z0-9 -]{1,8}[a-z0-9]$"}},"required":["postal_code"],"description":"The location the user entered for this search."},"SearchId":{"type":"string","pattern":"^ss_[0-9a-hjkmnp-tv-z]{26}$","description":"Opaque, stable saved-search id (`ss_` + 26 characters)."},"SearchList":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Search"}}},"required":["data"]},"SearchStatus":{"type":"string","description":"`active` runs on schedule, `paused` has stopped, `draft` has never run. Extensible.","x-extensible-enum":["active","paused","draft"],"examples":["active","paused","draft"]}}},"servers":[{"url":"https://api.dealhunter.io"}]}