{"openapi":"3.1.0","info":{"title":"Ekho API","version":"v1","description":"The Ekho external REST API."},"servers":[{"url":"https://api.ekho.com","description":"Production"}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Scoped API token shaped `ekho_{env}_{hex}`."}},"schemas":{"Me":{"type":"object","properties":{"principal":{"type":"string","enum":["api_token"],"example":"api_token"},"token_id":{"type":"string","description":"The API token id."},"token_prefix":{"type":"string","example":"ekho_live_3fa9c21b","description":"Display prefix of the token."},"account_ids":{"type":"array","items":{"type":"string"},"description":"Accounts this token may access."},"scopes":{"type":"array","items":{"type":"string","enum":["orders:read","orders:write","payments:read","payouts:read","leads:read","leads:write","preorders:read","preorders:write","webhooks:read","webhooks:write"]},"description":"Scopes granted to the token."}},"required":["principal","token_id","token_prefix","account_ids","scopes"]},"Problem":{"type":"object","properties":{"type":{"type":"string","enum":["https://docs.ekhodealer.com/api-reference/errors/validation-error","https://docs.ekhodealer.com/api-reference/errors/unauthorized","https://docs.ekhodealer.com/api-reference/errors/insufficient-scope","https://docs.ekhodealer.com/api-reference/errors/not-found","https://docs.ekhodealer.com/api-reference/errors/conflict","https://docs.ekhodealer.com/api-reference/errors/rate-limited","https://docs.ekhodealer.com/api-reference/errors/internal-error"],"description":"Dereferenceable URI identifying the problem type.","example":"https://docs.ekhodealer.com/api-reference/errors/validation-error"},"title":{"type":"string","description":"Short, human-readable summary.","example":"Bad request"},"status":{"type":"integer","description":"HTTP status code.","example":400},"detail":{"type":"string","description":"Explanation specific to this occurrence.","example":"One or more fields are invalid."},"code":{"type":"string","enum":["invalid_token","validation_error","insufficient_scope"],"description":"Stable machine-readable error code.","example":"validation_error"},"param":{"type":"string","description":"The single parameter at fault, when applicable.","example":"limit"},"doc_url":{"type":"string","description":"Link to documentation for this error.","example":"https://docs.ekhodealer.com/api-reference/errors/validation-error"},"request_id":{"type":"string","description":"Correlation id, matching `X-Request-Id`.","example":"3f9a2c1e-8b47-4d52-9e13-7a5c0f6b8d21"},"errors":{"type":"array","items":{"$ref":"#/components/schemas/ProblemFieldError"},"description":"All field-level issues, present on validation failures."}},"required":["type","title","status"]},"ProblemFieldError":{"type":"object","properties":{"param":{"type":"string","description":"Dotted path to the offending field.","example":"limit"},"code":{"type":"string","description":"Machine-readable issue code.","example":"too_big"},"detail":{"type":"string","description":"Human-readable description of the issue.","example":"limit must be 100 or fewer."}},"required":["detail"]},"Preorder":{"type":"object","properties":{"id":{"type":"string","example":"m3Vt8sQjRk2dLw9pXb4C"},"created_at":{"type":"integer","description":"Epoch ms the reservation fee was paid."},"canceled_at":{"type":["integer","null"]},"status":{"type":"string","enum":["pending_invitation","awaiting_checkout","idle","converted","canceled"]},"catalog_vehicle":{"$ref":"#/components/schemas/CatalogVehicle"},"deposit":{"type":"number","description":"Reservation fee paid, USD."},"converted_order_id":{"type":["string","null"]},"checkout_cart_id":{"type":["string","null"]},"converted_cart_id":{"type":["string","null"]},"assigned_account_id":{"type":["string","null"]},"buyer":{"$ref":"#/components/schemas/PreorderBuyer"},"pga":{"type":"array","items":{"$ref":"#/components/schemas/Pga"},"description":"Parts, garments, and accessories (PG&A) sold with the build."},"metadata":{"type":"object","additionalProperties":{},"description":"Free-form metadata carried on the preorder, including whatever was attached at cart creation. Published exactly as written, so objects and arrays round-trip with their structure intact. Always present, empty when unset."}},"required":["id","created_at","canceled_at","status","catalog_vehicle","deposit","converted_order_id","checkout_cart_id","converted_cart_id","assigned_account_id","pga","metadata"]},"CatalogVehicle":{"type":"object","properties":{"name":{"type":"string"},"img_url":{"type":["string","null"]},"base_price":{"type":"number","description":"Base price USD of the build, before specs and PG&A."},"specs":{"type":"array","items":{"$ref":"#/components/schemas/Spec"},"description":"The build-defining items configured onto this vehicle."}},"required":["name","img_url","base_price","specs"]},"Spec":{"type":"object","properties":{"name":{"type":"string"},"category":{"type":["string","null"]},"sku":{"type":["string","null"]},"price":{"type":"number","description":"Price USD as sold. 0 for items included in the base price."},"description":{"type":["string","null"]},"img_url":{"type":["string","null"]}},"required":["name","category","sku","price","description","img_url"]},"PreorderBuyer":{"type":"object","properties":{"id":{"type":"string","description":"Buyer id, the same handle on every resource."},"full_name":{"type":"string"},"email":{"type":["string","null"],"description":"Buyer email; null when the buyer record is unavailable."},"phone":{"type":["string","null"],"description":"Buyer phone; null when the buyer record is unavailable."},"address":{"$ref":"#/components/schemas/BuyerAddress"}},"required":["id","full_name","email","phone","address"],"description":"Buyer with PII. Present only when requested via `?expand[]=buyer`."},"BuyerAddress":{"type":["object","null"],"properties":{"line1":{"type":"string"},"line2":{"type":["string","null"]},"city":{"type":"string"},"state":{"type":"string","description":"Two-letter state code."},"zip":{"type":"string"},"country":{"type":["string","null"],"description":"ISO 3166-1 alpha-2; null implies US."}},"required":["line1","line2","city","state","zip","country"],"description":"Buyer address; null when none is on file."},"Pga":{"type":"object","properties":{"type":{"type":"string","enum":["part","garment","accessory"]},"name":{"type":"string"},"category":{"type":["string","null"]},"sku":{"type":["string","null"]},"price":{"type":"number","description":"Unit price USD as sold. 0 for included items."},"quantity":{"type":"integer","minimum":1},"description":{"type":["string","null"]},"img_url":{"type":["string","null"]}},"required":["type","name","category","sku","price","quantity","description","img_url"]},"Lead":{"type":"object","properties":{"id":{"type":"string","example":"Kj7Xp2mQvR4tLw9dZa3B"},"created_at":{"type":"integer","description":"Epoch ms the lead was created."},"updated_at":{"type":"integer","description":"Epoch ms of the last change."},"stage":{"type":"string","enum":["new","to_reach_out","engaged","needs_attention","booked","on_hold","closed_won","closed_lost"]},"type":{"type":"string","enum":["partial_order","partial_preorder","rejected_financing","buy_in_person","inquiry","conversation","pre_qual","external_crm"]},"buyer":{"$ref":"#/components/schemas/LeadBuyer"},"estimated_value":{"type":"number","description":"USD value of the attached cart or deal; 0 when none."},"assigned_account_id":{"type":["string","null"],"description":"The account the lead is routed to; null when unrouted."}},"required":["id","created_at","updated_at","stage","type","buyer","estimated_value","assigned_account_id"]},"LeadBuyer":{"type":"object","properties":{"id":{"type":["string","null"],"description":"Resolved customer id; null until the lead matches a customer."},"full_name":{"type":["string","null"]},"email":{"type":["string","null"]},"phone":{"type":["string","null"],"description":"As captured; no formatting guarantee."},"address":{"allOf":[{"$ref":"#/components/schemas/BuyerAddress"},{"description":"Buyer address from the linked profile; null when none is on file."}]}},"required":["id","full_name","email","phone","address"],"description":"Captured contact info, always present; carries PII."},"Order":{"type":"object","properties":{"id":{"type":"string","example":"Tn6Kv2sBjW8pRc4yLm9D"},"vehicle_ids":{"type":"array","items":{"type":"string"},"description":"Ids of the caller-owned purchased vehicles under this order."}},"required":["id","vehicle_ids"]},"PurchasedVehicle":{"type":"object","properties":{"id":{"type":"string","example":"Wd5Fy9nJcQ3rXt7bLm2P"},"order_id":{"type":"string","description":"The placed order this vehicle belongs to."},"preorder_id":{"type":["string","null"],"description":"The preorder this vehicle was converted from; null when the order was placed directly."},"created_at":{"type":"integer","description":"Epoch ms the vehicle was purchased."},"updated_at":{"type":"integer","description":"Epoch ms of the last update."},"status":{"type":"string","enum":["pending","sales_processing","kick_off_fulfillment","in_fulfillment","fulfilled","canceled"],"description":"Where the order stands, from sales processing through fulfillment."},"vin":{"type":["string","null"]},"engine_number":{"type":["string","null"]},"mco_number":{"type":["string","null"],"description":"Identifier on the Manufacturer's Certificate of Origin. Always null in this version."},"catalog_vehicle":{"$ref":"#/components/schemas/CatalogVehicle"},"fulfillment_details":{"$ref":"#/components/schemas/FulfillmentDetails"},"buyer":{"$ref":"#/components/schemas/VehicleBuyer"},"payments":{"$ref":"#/components/schemas/Payments"},"payouts":{"$ref":"#/components/schemas/Payouts"},"metadata":{"type":"object","additionalProperties":{},"description":"Free-form metadata carried on the vehicle, including whatever was attached at cart creation. Published exactly as written, so objects and arrays round-trip with their structure intact. Always present, empty when unset."}},"required":["id","order_id","preorder_id","created_at","updated_at","status","vin","engine_number","mco_number","catalog_vehicle","fulfillment_details","metadata"]},"FulfillmentDetails":{"type":["object","null"],"properties":{"method":{"type":"string","enum":["pickup","delivery"]},"assigned_account_id":{"type":"string","description":"The account performing the handoff (pickup host or shipper)."},"assigned_account_name":{"type":["string","null"],"description":"Business name of that account. Null when the account is unavailable, and on webhook deliveries."},"address":{"allOf":[{"$ref":"#/components/schemas/BuyerAddress"},{"description":"Pickup location for pickup, buyer destination for delivery."}]},"estimated_delivery_date":{"type":["integer","null"],"description":"Epoch ms the vehicle is expected to reach the buyer."},"vehicle_tracking_reference":{"type":["string","null"],"description":"Carrier tracking number or link; null until dispatched."}},"required":["method","assigned_account_id","assigned_account_name","address","estimated_delivery_date","vehicle_tracking_reference"]},"VehicleBuyer":{"type":"object","properties":{"id":{"type":"string","description":"Buyer id, the same handle on every resource."},"full_name":{"type":"string"},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"address":{"$ref":"#/components/schemas/BuyerAddress"}},"required":["id","full_name","email","phone","address"],"description":"Buyer with PII. Present only when requested via `?expand[]=buyer`."},"Payments":{"type":"object","properties":{"status":{"type":"string","enum":["no_payments","reservation_initiated","reservation_paid","downpayment_processing","downpayment_paid","financing_guaranteed","fully_paid","lost_dispute"],"description":"Where the vehicle stands on money collected. `no_payments` also covers a vehicle whose status is not set yet."},"paid":{"type":"number","description":"Total the buyer has paid, USD."},"balance":{"type":"number","description":"Outstanding buyer balance, USD."},"receipt":{"$ref":"#/components/schemas/Receipt"},"transactions":{"type":"array","items":{},"description":"Declared for forward compatibility; always empty in this version."}},"required":["status","paid","balance","receipt","transactions"],"description":"Buyer payments. Present only via `?expand[]=payments`, and requires `payments:read`."},"Receipt":{"type":["object","null"],"properties":{"grand_total":{"type":"number"},"vehicles":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"amount":{"type":"number"},"specs":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"amount":{"type":"number"}},"required":["label","amount"]}},"discounts":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"amount":{"type":"number"}},"required":["label","amount"]}}},"required":["label","amount","specs","discounts"]}},"pga":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"amount":{"type":"number"}},"required":["label","amount"]},"description":"Parts, garments, and accessories (PG&A)."},"taxes":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"amount":{"type":"number"}},"required":["label","amount"]}},"fees":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"amount":{"type":"number"}},"required":["label","amount"]}}},"required":["grand_total","vehicles","pga","taxes","fees"]},"Payouts":{"type":"object","properties":{"paid":{"type":"number","description":"Total paid to the caller's account, USD."},"balance":{"type":"number","description":"Outstanding payout balance, USD."},"summary":{"$ref":"#/components/schemas/PayoutSummary"}},"required":["paid","balance","summary"],"description":"The caller's own payouts. Present only via `?expand[]=payouts`, and requires `payouts:read`."},"PayoutSummary":{"type":"object","properties":{"total_expected_buyer_payment":{"type":"number"},"ekho_deductions":{"type":"object","properties":{"total":{"type":"number"},"items":{"type":"array","items":{"type":"object","properties":{"service":{"type":"string"},"amount":{"type":"number"}},"required":["service","amount"]}}},"required":["total","items"]},"other_deductions":{"type":"object","properties":{"total":{"type":"number"},"items":{"type":"array","items":{"type":"object","properties":{"service":{"type":"string"},"amount":{"type":"number"}},"required":["service","amount"]}}},"required":["total","items"]},"lender_incentives":{"type":"object","properties":{"total":{"type":"number"},"items":{"type":"array","items":{"type":"object","properties":{"service":{"type":"string"},"amount":{"type":"number"}},"required":["service","amount"]}}},"required":["total","items"]},"net_credits_deducted":{"type":"number","description":"A credit count, not an amount; excluded from the net."},"net_total_expected":{"type":"number"}},"required":["total_expected_buyer_payment","ekho_deductions","other_deductions","lender_incentives","net_credits_deducted","net_total_expected"]},"VehicleActionItem":{"type":"object","properties":{"id":{"type":"string","example":"Zc6Jt3wRbN8pKf1sVy5Q"},"status":{"type":"string","enum":["pending","completed"]},"created_at":{"type":"integer","description":"Epoch ms the item was created."},"updated_at":{"type":"integer","description":"Epoch ms of the last update."},"completed_at":{"type":["integer","null"],"description":"Epoch ms of completion; null while pending."},"action":{"type":"string","enum":["assign-vin","assign-motorcycle-engine-number","mark-production-complete","mark-in-transit-to-buyer"],"description":"The path segment to post to in order to complete this item."}},"required":["id","status","created_at","updated_at","completed_at","action"]},"CompleteActionItemRequest":{"type":"object","properties":{"vin":{"type":"string","minLength":1,"description":"Vehicle identification number."},"engine_number":{"type":"string","minLength":1,"description":"Motorcycle engine number."},"estimated_delivery_date":{"type":"integer","description":"Epoch ms the vehicle is expected to reach the buyer."},"vehicle_tracking_reference":{"type":"string","description":"Carrier tracking number or link."},"contact_number":{"type":"string","description":"A number the buyer can call about the shipment."},"company_name":{"type":"string","description":"Name of the fulfillment company."}}},"EventDestination":{"type":"object","properties":{"id":{"type":"string","example":"whe_a1b2c3d4e5f6","description":"Typed event destination id; ids carry the `whe_` prefix."},"url":{"type":"string"},"event_types":{"type":"array","items":{"type":"string","enum":["preorder.placed","preorder.updated","lead.created","lead.updated","order.vehicle.placed","order.vehicle.updated"]},"description":"Every event type this destination receives."},"status":{"type":"string","enum":["enabled","disabled","auto_disabled"]},"display_name":{"type":["string","null"]},"description":{"type":["string","null"]},"environment":{"type":"string","enum":["dev","test","demo","live"],"description":"Token environment the destination was created under."},"api_version":{"type":"string","example":"v1","description":"API version pinned at creation."},"secret":{"type":["string","null"],"example":"whsec_4f1d…","description":"The signing secret, returned only by create and rotate-secret. Store it on receipt; it is never shown again."},"created_at":{"type":"integer","description":"Epoch milliseconds the destination was created."}},"required":["id","url","event_types","status","display_name","description","environment","api_version","secret","created_at"]},"EventDestinationCreate":{"type":"object","properties":{"url":{"type":"string","format":"uri","example":"https://example.com/webhooks/preorder","description":"The https target URL that receives event deliveries."},"event_types":{"type":"array","items":{"type":"string","enum":["preorder.placed","preorder.updated","lead.created","lead.updated","order.vehicle.placed","order.vehicle.updated"]},"minItems":1,"example":["order.vehicle.placed","order.vehicle.updated"],"description":"Every event type this destination receives. One destination can carry as many types as you like, so a single URL needs only one signing secret. Read the envelope's `type` field to tell deliveries apart. Duplicates are collapsed."},"display_name":{"type":"string","maxLength":100,"description":"Optional human-friendly label for the destination."},"description":{"type":"string","maxLength":255,"description":"Optional longer description of the destination."}},"required":["url","event_types"]},"EventDestinationDeleted":{"type":"object","properties":{"id":{"type":"string"},"deleted":{"type":"boolean","enum":[true]}},"required":["id","deleted"]},"EventDestinationSecretRotate":{"type":"object","properties":{"previous_secret_expires_in_seconds":{"type":"integer","minimum":0,"maximum":604800,"example":3600,"description":"How long the outgoing secret keeps signing, so both secrets verify while you roll out the new one. Defaults to 86400 (24 hours). 0 retires the outgoing secret immediately; the maximum is 604800 (7 days)."}}},"WebhookEvent":{"type":"object","properties":{"id":{"type":"string","example":"evt_7Ye2kQp91LmXw4Za"},"type":{"type":"string","enum":["preorder.placed","preorder.updated","lead.created","lead.updated","order.vehicle.placed","order.vehicle.updated"]},"created":{"type":"integer","description":"Epoch ms the event fired."},"delivery_status":{"type":"string","enum":["pending","delivered","failed"],"description":"This destination's outcome: pending, delivered, or failed."},"attempt_count":{"type":"integer"},"last_attempted_at":{"type":["integer","null"]},"last_response_status_code":{"type":["integer","null"]},"attempts":{"type":"array","items":{"$ref":"#/components/schemas/WebhookEventAttempt"}}},"required":["id","type","created","delivery_status","attempt_count","last_attempted_at","last_response_status_code"]},"WebhookEventAttempt":{"type":"object","properties":{"id":{"type":"string","example":"atmpt_Zw8n1Rq4Yv5c"},"event_id":{"type":"string","example":"evt_7Ye2kQp91LmXw4Za"},"status":{"type":"string","enum":["success","failed"]},"response_status_code":{"type":["integer","null"]},"error_message":{"type":["string","null"]},"attempt_number":{"type":"integer"},"trigger_type":{"type":"string","enum":["scheduled","manual"]},"duration_ms":{"type":"integer"},"created_at":{"type":"integer"}},"required":["id","event_id","status","response_status_code","error_message","attempt_number","trigger_type","duration_ms","created_at"]},"AccountEvent":{"type":"object","properties":{"id":{"type":"string","example":"evt_7Ye2kQp91LmXw4Za"},"type":{"type":["string","null"],"enum":["preorder.placed","preorder.updated","lead.created","lead.updated","order.vehicle.placed","order.vehicle.updated",null],"description":"Null when the event has no partner-facing type and was never deliverable."},"created":{"type":"integer","description":"Epoch ms the event fired."},"status":{"type":"string","enum":["no_subscribers","pending","delivered","partial","failed"],"description":"Delivery state across every target: no_subscribers, pending, delivered, partial, or failed."},"subscription_count":{"type":"integer","description":"Targets matched when the event fired."},"delivered_count":{"type":"integer"},"failed_count":{"type":"integer"},"resource_ids":{"type":"array","items":{"type":"string"},"description":"Ids of the resources the event payload references."}},"required":["id","type","created","status","subscription_count","delivered_count","failed_count","resource_ids"]},"EventRedelivery":{"type":"object","properties":{"id":{"type":"string","example":"evt_7Ye2kQp91LmXw4Za"},"redelivered":{"type":"boolean","enum":[true]},"results":{"type":"array","items":{"$ref":"#/components/schemas/EventRedeliveryResult"},"description":"One entry per target the event was replayed to, resolved at replay time. Empty when no target currently subscribes to the event."}},"required":["id","redelivered","results"]},"EventRedeliveryResult":{"type":"object","properties":{"destination":{"type":["string","null"],"description":"The event destination that received the replay, or null for a legacy subscription.","example":"whe_a1b2c3d4e5f6"},"status":{"type":"string","enum":["delivered","failed"]}},"required":["destination","status"]}},"parameters":{}},"paths":{"/me":{"get":{"tags":["Identity"],"summary":"Get the authenticated principal","description":"Returns the token id, display prefix, accounts, and scopes of the caller.","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The authenticated principal.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Me"}},"required":["data"]}}}},"400":{"description":"The request was malformed or failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Authentication is missing or invalid.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The token lacks a required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"The rate limit has been exceeded.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"An unexpected error occurred.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/preorders":{"get":{"tags":["Preorders"],"summary":"List preorders","description":"Returns a cursor-paginated list of the caller-owned, paid preorders, newest first. Filter by status and reservation-fee date.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20,"description":"Page size, 1 to 100.","example":20},"required":false,"description":"Page size, 1 to 100.","name":"limit","in":"query"},{"schema":{"type":"string","description":"Return the page after this resource id (newest first)."},"required":false,"description":"Return the page after this resource id (newest first).","name":"starting_after","in":"query"},{"schema":{"type":"string","enum":["pending_invitation","awaiting_checkout","idle","converted","canceled"],"description":"Filter to a single preorder status."},"required":false,"description":"Filter to a single preorder status.","name":"status","in":"query"},{"schema":{"type":["integer","null"],"description":"Only preorders paid at or after this epoch ms."},"required":false,"description":"Only preorders paid at or after this epoch ms.","name":"created[gte]","in":"query"},{"schema":{"type":["integer","null"],"description":"Only preorders paid at or before this epoch ms."},"required":false,"description":"Only preorders paid at or before this epoch ms.","name":"created[lte]","in":"query"},{"schema":{"type":"array","items":{"type":"string","enum":["buyer"]},"description":"Repeatable. Expand `buyer` to include the buyer (with PII)."},"required":false,"description":"Repeatable. Expand `buyer` to include the buyer (with PII).","name":"expand[]","in":"query"}],"responses":{"200":{"description":"A page of preorders.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Preorder"}},"has_more":{"type":"boolean","description":"True when another page follows the returned one."},"next_cursor":{"type":["string","null"],"description":"Pass as `starting_after` to fetch the next page; null when `has_more` is false."}},"required":["data","has_more","next_cursor"]}}}},"400":{"description":"The request was malformed or failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Authentication is missing or invalid.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The token lacks a required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"The rate limit has been exceeded.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"An unexpected error occurred.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/preorders/{id}":{"get":{"tags":["Preorders"],"summary":"Retrieve a preorder","description":"Returns a single caller-owned, paid preorder by its id.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","example":"m3Vt8sQjRk2dLw9pXb4C"},"required":true,"name":"id","in":"path"},{"schema":{"type":"array","items":{"type":"string","enum":["buyer"]},"description":"Repeatable. Expand `buyer` to include the buyer (with PII)."},"required":false,"description":"Repeatable. Expand `buyer` to include the buyer (with PII).","name":"expand[]","in":"query"}],"responses":{"200":{"description":"The requested preorder.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Preorder"}},"required":["data"]}}}},"400":{"description":"The request was malformed or failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Authentication is missing or invalid.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The token lacks a required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"No preorder matches that id.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"The rate limit has been exceeded.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"An unexpected error occurred.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/leads":{"get":{"tags":["Leads"],"summary":"List leads","description":"Returns a cursor-paginated list of the caller-owned leads, newest first. Filter by stage, type, contact email, and creation date.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20,"description":"Page size, 1 to 100.","example":20},"required":false,"description":"Page size, 1 to 100.","name":"limit","in":"query"},{"schema":{"type":"string","description":"Return the page after this resource id (newest first)."},"required":false,"description":"Return the page after this resource id (newest first).","name":"starting_after","in":"query"},{"schema":{"type":"string","enum":["new","to_reach_out","engaged","needs_attention","booked","on_hold","closed_won","closed_lost"],"description":"Filter to a single lead stage."},"required":false,"description":"Filter to a single lead stage.","name":"stage","in":"query"},{"schema":{"type":"string","enum":["partial_order","partial_preorder","rejected_financing","buy_in_person","inquiry","conversation","pre_qual","external_crm"],"description":"Filter to a single lead type."},"required":false,"description":"Filter to a single lead type.","name":"type","in":"query"},{"schema":{"type":"string","description":"Exact-match contact email; backs the find-lead search."},"required":false,"description":"Exact-match contact email; backs the find-lead search.","name":"email","in":"query"},{"schema":{"type":["integer","null"],"description":"Only leads created at or after this epoch ms."},"required":false,"description":"Only leads created at or after this epoch ms.","name":"created[gte]","in":"query"},{"schema":{"type":["integer","null"],"description":"Only leads created at or before this epoch ms."},"required":false,"description":"Only leads created at or before this epoch ms.","name":"created[lte]","in":"query"}],"responses":{"200":{"description":"A page of leads.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Lead"}},"has_more":{"type":"boolean","description":"True when another page follows the returned one."},"next_cursor":{"type":["string","null"],"description":"Pass as `starting_after` to fetch the next page; null when `has_more` is false."}},"required":["data","has_more","next_cursor"]}}}},"400":{"description":"The request was malformed or failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Authentication is missing or invalid.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The token lacks a required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"The rate limit has been exceeded.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"An unexpected error occurred.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/leads/{id}":{"get":{"tags":["Leads"],"summary":"Retrieve a lead","description":"Returns a single caller-owned lead by its id.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","example":"Kj7Xp2mQvR4tLw9dZa3B"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The requested lead.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Lead"}},"required":["data"]}}}},"400":{"description":"The request was malformed or failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Authentication is missing or invalid.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The token lacks a required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"No lead matches that id.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"The rate limit has been exceeded.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"An unexpected error occurred.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/orders/{id}":{"get":{"tags":["Orders"],"summary":"Retrieve an order","description":"Returns the ids of the caller-owned purchased vehicles under one order. Partners interact with vehicles, so the order itself carries nothing else.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","example":"Tn6Kv2sBjW8pRc4yLm9D"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The requested order.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Order"}},"required":["data"]}}}},"400":{"description":"The request was malformed or failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Authentication is missing or invalid.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The token lacks a required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"No order matches that id.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"The rate limit has been exceeded.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"An unexpected error occurred.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/orders/{orderId}/vehicles":{"get":{"tags":["Orders"],"summary":"List an order's vehicles","description":"Returns the caller-owned ordered vehicles under one of the caller's orders, newest first.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","example":"Tn6Kv2sBjW8pRc4yLm9D"},"required":true,"name":"orderId","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20,"description":"Page size, 1 to 100.","example":20},"required":false,"description":"Page size, 1 to 100.","name":"limit","in":"query"},{"schema":{"type":"string","description":"Return the page after this resource id (newest first)."},"required":false,"description":"Return the page after this resource id (newest first).","name":"starting_after","in":"query"},{"schema":{"type":"array","items":{"type":"string","enum":["buyer","payments","payouts"]},"description":"Repeatable. `buyer` includes the buyer (with PII); `payments` includes the buyer’s payments and requires `payments:read`; `payouts` includes the caller’s payouts and requires `payouts:read`."},"required":false,"description":"Repeatable. `buyer` includes the buyer (with PII); `payments` includes the buyer’s payments and requires `payments:read`; `payouts` includes the caller’s payouts and requires `payouts:read`.","name":"expand[]","in":"query"}],"responses":{"200":{"description":"A page of ordered vehicles.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PurchasedVehicle"}},"has_more":{"type":"boolean","description":"True when another page follows the returned one."},"next_cursor":{"type":["string","null"],"description":"Pass as `starting_after` to fetch the next page; null when `has_more` is false."}},"required":["data","has_more","next_cursor"]}}}},"400":{"description":"The request was malformed or failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Authentication is missing or invalid.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The token lacks a required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"No order matches that id.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"The rate limit has been exceeded.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"An unexpected error occurred.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/orders/{orderId}/vehicles/{vehicleId}":{"get":{"tags":["Orders"],"summary":"Retrieve an ordered vehicle","description":"Returns a single caller-owned ordered vehicle under one of the caller's orders.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","example":"Tn6Kv2sBjW8pRc4yLm9D"},"required":true,"name":"orderId","in":"path"},{"schema":{"type":"string","example":"Wd5Fy9nJcQ3rXt7bLm2P"},"required":true,"name":"vehicleId","in":"path"},{"schema":{"type":"array","items":{"type":"string","enum":["buyer","payments","payouts"]},"description":"Repeatable. `buyer` includes the buyer (with PII); `payments` includes the buyer’s payments and requires `payments:read`; `payouts` includes the caller’s payouts and requires `payouts:read`."},"required":false,"description":"Repeatable. `buyer` includes the buyer (with PII); `payments` includes the buyer’s payments and requires `payments:read`; `payouts` includes the caller’s payouts and requires `payouts:read`.","name":"expand[]","in":"query"}],"responses":{"200":{"description":"The requested vehicle.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PurchasedVehicle"}},"required":["data"]}}}},"400":{"description":"The request was malformed or failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Authentication is missing or invalid.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The token lacks a required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"No vehicle matches that id under that order.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"The rate limit has been exceeded.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"An unexpected error occurred.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/orders/{orderId}/vehicles/{vehicleId}/action-items":{"get":{"tags":["Orders"],"summary":"List a vehicle's action items","description":"Returns the action items on this vehicle assigned to your account—pending and completed—optionally filtered by status. Items that are not yet actionable, and items another account is responsible for, are omitted.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","example":"Tn6Kv2sBjW8pRc4yLm9D"},"required":true,"name":"orderId","in":"path"},{"schema":{"type":"string","example":"Wd5Fy9nJcQ3rXt7bLm2P"},"required":true,"name":"vehicleId","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20,"description":"Page size, 1 to 100.","example":20},"required":false,"description":"Page size, 1 to 100.","name":"limit","in":"query"},{"schema":{"type":"string","description":"Return the page after this resource id (newest first)."},"required":false,"description":"Return the page after this resource id (newest first).","name":"starting_after","in":"query"},{"schema":{"type":"string","enum":["pending","completed"],"description":"Return only items in this state; omit for both."},"required":false,"description":"Return only items in this state; omit for both.","name":"status","in":"query"}],"responses":{"200":{"description":"A page of action items.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/VehicleActionItem"}},"has_more":{"type":"boolean","description":"True when another page follows the returned one."},"next_cursor":{"type":["string","null"],"description":"Pass as `starting_after` to fetch the next page; null when `has_more` is false."}},"required":["data","has_more","next_cursor"]}}}},"400":{"description":"The request was malformed or failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Authentication is missing or invalid.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The token lacks a required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"No vehicle matches that id under that order.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"The rate limit has been exceeded.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"An unexpected error occurred.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/orders/{orderId}/vehicles/{vehicleId}/action-items/{action}":{"post":{"tags":["Orders"],"summary":"Complete an action item","description":"Completes one action item on a vehicle and returns the resulting vehicle. The body carries only the fields that action needs, and an action that needs none takes an empty object; there is no partial success.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","example":"Tn6Kv2sBjW8pRc4yLm9D"},"required":true,"name":"orderId","in":"path"},{"schema":{"type":"string","example":"Wd5Fy9nJcQ3rXt7bLm2P"},"required":true,"name":"vehicleId","in":"path"},{"schema":{"type":"string","enum":["assign-vin","assign-motorcycle-engine-number","mark-production-complete","mark-in-transit-to-buyer"],"description":"The action item to complete.","example":"assign-vin"},"required":true,"description":"The action item to complete.","name":"action","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompleteActionItemRequest"}}}},"responses":{"200":{"description":"The vehicle as it stands after the action.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PurchasedVehicle"}},"required":["data"]}}}},"400":{"description":"The request was malformed or failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Authentication is missing or invalid.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The token lacks a required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"No vehicle matches that id under that order.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"The action item is not completable in the vehicle’s current state.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"The rate limit has been exceeded.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"An unexpected error occurred.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/event-destinations":{"post":{"tags":["Events"],"summary":"Create an event destination","description":"Registers an event destination bound to the token's account. List every subscribable event type the URL should receive on `event_types`; one destination can carry as many as you like, so a URL needs only one signing secret and your handler branches on the envelope's `type`. Register a second destination to deliver to a different URL, not to separate one event type from another. The secret is returned once, in this response. The target is validated as an https URL and screened by the delivery-time SSRF guard before it is stored. The `api_version` is pinned from the resolved `Ekho-Version`, and the creation channel is inferred from the User-Agent (Zapier clients record `zapier`, everything else `api`).","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventDestinationCreate"}}}},"responses":{"201":{"description":"The event destination was created.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EventDestination"}},"required":["data"]}}}},"400":{"description":"The request was malformed or failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Authentication is missing or invalid.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The token lacks a required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"The rate limit has been exceeded.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"An unexpected error occurred.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"get":{"tags":["Events"],"summary":"List event destinations","description":"Returns a cursor-paginated list of the account's event destinations, newest first. Filter by `status`, or by `event_type` to return every destination whose `event_types` include that one. Deleted destinations are excluded.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20,"description":"Page size, 1 to 100.","example":20},"required":false,"description":"Page size, 1 to 100.","name":"limit","in":"query"},{"schema":{"type":"string","description":"Return the page after this resource id (newest first)."},"required":false,"description":"Return the page after this resource id (newest first).","name":"starting_after","in":"query"},{"schema":{"type":"string","enum":["enabled","disabled","auto_disabled"],"description":"Filter to a single destination status."},"required":false,"description":"Filter to a single destination status.","name":"status","in":"query"},{"schema":{"type":"string","enum":["preorder.placed","preorder.updated","lead.created","lead.updated","order.vehicle.placed","order.vehicle.updated"],"description":"Filter to destinations whose `event_types` include this one."},"required":false,"description":"Filter to destinations whose `event_types` include this one.","name":"event_type","in":"query"}],"responses":{"200":{"description":"A page of event destinations.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/EventDestination"}},"has_more":{"type":"boolean","description":"True when another page follows the returned one."},"next_cursor":{"type":["string","null"],"description":"Pass as `starting_after` to fetch the next page; null when `has_more` is false."}},"required":["data","has_more","next_cursor"]}}}},"400":{"description":"The request was malformed or failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Authentication is missing or invalid.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The token lacks a required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"The rate limit has been exceeded.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"An unexpected error occurred.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/event-destinations/{id}":{"get":{"tags":["Events"],"summary":"Retrieve an event destination","description":"Returns a single account-owned event destination by its `whe_` id.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","example":"whe_a1b2c3d4e5f6"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The requested event destination.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EventDestination"}},"required":["data"]}}}},"400":{"description":"The request was malformed or failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Authentication is missing or invalid.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The token lacks a required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"No event destination matches that id.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"The rate limit has been exceeded.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"An unexpected error occurred.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"delete":{"tags":["Events"],"summary":"Delete an event destination","description":"Deletes an event destination: delivery stops immediately and the destination disappears from list and retrieve, while its recorded events and delivery attempts are retained. Returns a deleted marker; subsequent retrieves and deletes of the same id return 404.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","example":"whe_a1b2c3d4e5f6"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The event destination was deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EventDestinationDeleted"}},"required":["data"]}}}},"400":{"description":"The request was malformed or failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Authentication is missing or invalid.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The token lacks a required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"No event destination matches that id.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"The rate limit has been exceeded.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"An unexpected error occurred.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/event-destinations/{id}/rotate-secret":{"post":{"tags":["Events"],"summary":"Rotate an event destination's signing secret","description":"Mints a new signing secret and returns it in `secret`. This is the only response other than create that carries the plaintext, so store it on receipt. The outgoing secret keeps signing for `previous_secret_expires_in_seconds` (24 hours by default, 0 for an immediate cutover), and during that overlap each delivery carries one `v1=` signature per active secret, so either one verifies while you roll out the new one.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","example":"whe_a1b2c3d4e5f6"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventDestinationSecretRotate"}}}},"responses":{"200":{"description":"The signing secret was rotated.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EventDestination"}},"required":["data"]}}}},"400":{"description":"The request was malformed or failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Authentication is missing or invalid.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The token lacks a required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"No event destination matches that id.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"The rate limit has been exceeded.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"An unexpected error occurred.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/event-destinations/{id}/events":{"get":{"tags":["Events"],"summary":"List an event destination's events","description":"Returns a cursor-paginated list of the events fanned out to this destination, newest first, with the destination's per-event delivery outcome. Filter by `delivery_status` and fire time (`created[gte]` / `created[lte]`), and expand `attempts` to include each delivery try. Events remain inspectable after the destination is deleted.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","example":"whe_a1b2c3d4e5f6"},"required":true,"name":"id","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20,"description":"Page size, 1 to 100.","example":20},"required":false,"description":"Page size, 1 to 100.","name":"limit","in":"query"},{"schema":{"type":"string","description":"Return the page after this resource id (newest first)."},"required":false,"description":"Return the page after this resource id (newest first).","name":"starting_after","in":"query"},{"schema":{"type":"string","enum":["pending","delivered","failed"],"description":"Filter to a single per-destination delivery status."},"required":false,"description":"Filter to a single per-destination delivery status.","name":"delivery_status","in":"query"},{"schema":{"type":["integer","null"],"description":"Only events fired at or after this epoch ms."},"required":false,"description":"Only events fired at or after this epoch ms.","name":"created[gte]","in":"query"},{"schema":{"type":["integer","null"],"description":"Only events fired at or before this epoch ms."},"required":false,"description":"Only events fired at or before this epoch ms.","name":"created[lte]","in":"query"},{"schema":{"type":"array","items":{"type":"string","enum":["attempts"]},"description":"Repeatable. Expand `attempts` to include each delivery try."},"required":false,"description":"Repeatable. Expand `attempts` to include each delivery try.","name":"expand[]","in":"query"}],"responses":{"200":{"description":"A page of events for the destination.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/WebhookEvent"}},"has_more":{"type":"boolean","description":"True when another page follows the returned one."},"next_cursor":{"type":["string","null"],"description":"Pass as `starting_after` to fetch the next page; null when `has_more` is false."}},"required":["data","has_more","next_cursor"]}}}},"400":{"description":"The request was malformed or failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Authentication is missing or invalid.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The token lacks a required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"No event destination matches that id.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"The rate limit has been exceeded.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"An unexpected error occurred.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/events":{"get":{"tags":["Events"],"summary":"List events","description":"Returns a cursor-paginated list of the events recorded for your account, newest first, with each event delivery state across every target. Filter by `status`, `event_type`, and fire time (`created[gte]` / `created[lte]`). Unlike the per-destination events feed this is scoped to the account, so it also lists events for an account that owns no event destination. Event bodies are not returned.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20,"description":"Page size, 1 to 100.","example":20},"required":false,"description":"Page size, 1 to 100.","name":"limit","in":"query"},{"schema":{"type":"string","description":"Return the page after this resource id (newest first)."},"required":false,"description":"Return the page after this resource id (newest first).","name":"starting_after","in":"query"},{"schema":{"type":"string","enum":["no_subscribers","pending","delivered","partial","failed"],"description":"Filter to a single delivery state, e.g. `failed`."},"required":false,"description":"Filter to a single delivery state, e.g. `failed`.","name":"status","in":"query"},{"schema":{"type":"string","enum":["preorder.placed","preorder.updated","lead.created","lead.updated","order.vehicle.placed","order.vehicle.updated"],"description":"Filter to a single event type."},"required":false,"description":"Filter to a single event type.","name":"event_type","in":"query"},{"schema":{"type":["integer","null"],"description":"Only events fired at or after this epoch ms."},"required":false,"description":"Only events fired at or after this epoch ms.","name":"created[gte]","in":"query"},{"schema":{"type":["integer","null"],"description":"Only events fired at or before this epoch ms."},"required":false,"description":"Only events fired at or before this epoch ms.","name":"created[lte]","in":"query"}],"responses":{"200":{"description":"A page of events for the account.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/AccountEvent"}},"has_more":{"type":"boolean","description":"True when another page follows the returned one."},"next_cursor":{"type":["string","null"],"description":"Pass as `starting_after` to fetch the next page; null when `has_more` is false."}},"required":["data","has_more","next_cursor"]}}}},"400":{"description":"The request was malformed or failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Authentication is missing or invalid.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The token lacks a required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"The rate limit has been exceeded.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"An unexpected error occurred.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/events/{id}/redeliver":{"post":{"tags":["Events"],"summary":"Replay an event","description":"Replays a recorded event to every destination currently subscribed to its type, plus any legacy subscription on the account. The stored envelope is sent verbatim, so you receive what the original delivery should have sent rather than a re-render of current state. Targets are resolved at replay time, so a destination added or repointed since the original fire receives it. Attempts are recorded against the same event and are distinguishable from the original delivery. Replaying is safe to repeat; treat the delivered event as a duplicate and key off the event `id`.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","example":"evt_7Ye2kQp91LmXw4Za"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The replay ran; each target carries its own outcome.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EventRedelivery"}},"required":["data"]}}}},"400":{"description":"The request was malformed or failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Authentication is missing or invalid.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The token lacks a required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"No event on this account matches that id.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"The event body was not retained at full size and cannot be replayed.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"The rate limit has been exceeded.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"An unexpected error occurred.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}}},"webhooks":{}}