{"openapi":"3.1.0","info":{"title":"GET /api/v1/customers","version":"1.0.0","description":"List customers"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/customers":{"get":{"tags":["customers"],"summary":"List customers","description":"Retrieve all customers for the business with optional filtering.","operationId":"get_customers_api_v1_customers_get","parameters":[{"name":"id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by specific customer ID","title":"Id"},"description":"Filter by specific customer ID"},{"name":"email","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by customer email address","title":"Email"},"description":"Filter by customer email address"},{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string","minLength":1,"maxLength":200},{"type":"null"}],"description":"Fuzzy search customers by name (uses trigram matching)","title":"Search"},"description":"Fuzzy search customers by name (uses trigram matching)"},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Cursor for pagination","title":"Cursor"},"description":"Cursor for pagination"},{"name":"limit","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","maximum":1000,"minimum":1},{"type":"null"}],"description":"Pagination limit","title":"Limit"},"description":"Pagination limit"},{"name":"direction","in":"query","required":false,"schema":{"type":"string","description":"Pagination direction: 'next' or 'prev'","default":"next","title":"Direction"},"description":"Pagination direction: 'next' or 'prev'"},{"name":"include_total_count","in":"query","required":false,"schema":{"type":"boolean","description":"Whether to include total count (expensive - avoid if possible)","default":false,"title":"Include Total Count"},"description":"Whether to include total count (expensive - avoid if possible)"},{"name":"sort_by","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Column name to sort by (e.g. 'created_at', 'amount', 'name'). When changing sort, reset cursor to None.","title":"Sort By"},"description":"Column name to sort by (e.g. 'created_at', 'amount', 'name'). When changing sort, reset cursor to None."},{"name":"descending","in":"query","required":false,"schema":{"type":"boolean","description":"Sort direction: true for descending (newest/largest first), false for ascending","default":true,"title":"Descending"},"description":"Sort direction: true for descending (newest/largest first), false for ascending"},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerListResponse"}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"example":{"detail":"Not authenticated"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"example":{"detail":"Not enough permissions"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"CustomerContactResponse":{"properties":{"id":{"type":"string","title":"Id","description":"Contact UUID."},"customer_id":{"type":"string","title":"Customer Id","description":"Customer UUID."},"name":{"type":"string","title":"Name","description":"Contact name."},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email","description":"Contact email."},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone","description":"Contact phone."},"role":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Role","description":"Contact role (e.g., 'Billing', 'Technical')."},"is_primary":{"type":"boolean","title":"Is Primary","description":"Whether this is the primary contact.","default":false},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes","description":"Notes about this contact."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp."},"updated_at":{"type":"string","format":"date-time","title":"Updated At","description":"Last update timestamp."}},"type":"object","required":["id","customer_id","name","created_at","updated_at"],"title":"CustomerContactResponse","description":"Response schema for a customer contact."},"CustomerListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/CustomerResponse"},"type":"array","title":"Items","description":"List of items"},"total":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Total","description":"Total number of items (null when not calculated for performance)"},"limit":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Limit","description":"Pagination limit"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor","description":"Cursor for next page"},"prev_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Prev Cursor","description":"Cursor for previous page"},"has_next":{"type":"boolean","title":"Has Next","description":"Whether there are more items"},"has_prev":{"type":"boolean","title":"Has Prev","description":"Whether there are previous items"}},"type":"object","required":["items","has_next","has_prev"],"title":"CustomerListResponse","description":"Paginated list of customers with cursor-based navigation."},"CustomerResponse":{"properties":{"id":{"type":"string","title":"Id","description":"Customer UUID."},"business_id":{"type":"string","title":"Business Id","description":"Business UUID."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp."},"updated_at":{"type":"string","format":"date-time","title":"Updated At","description":"Last update timestamp."},"name":{"type":"string","title":"Name","description":"Customer name."},"email":{"type":"string","title":"Email","description":"Customer email."},"address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Address","description":"Customer address."},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone","description":"Customer phone number."},"tax_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tax Id","description":"Tax identification number."},"website":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Website","description":"Customer website URL."},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes","description":"Internal notes."},"credit_limit_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Credit Limit Cents","description":"Credit limit in cents."},"default_payment_term_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Default Payment Term Id","description":"Default payment term ID."},"status":{"type":"string","title":"Status","description":"Customer status.","default":"active"},"category":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category","description":"Business category."},"is_deleted":{"type":"boolean","title":"Is Deleted","description":"Whether customer is soft deleted.","default":false},"deleted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Deleted At","description":"Timestamp when customer was deleted."},"stripe_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stripe Customer Id","description":"Linked Stripe customer ID."},"invoice_footer":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoice Footer","description":"Custom invoice footer/payment instructions for this customer."},"contacts":{"anyOf":[{"items":{"$ref":"#/components/schemas/CustomerContactResponse"},"type":"array"},{"type":"null"}],"title":"Contacts","description":"Customer contacts."}},"additionalProperties":true,"type":"object","required":["id","business_id","created_at","updated_at","name","email"],"title":"CustomerResponse","description":"Response schema for a customer.\n\nContains customer details and any linked external IDs.","example":{"address":"123 Main Street, Suite 100, San Francisco, CA 94102","business_id":"019ab37c-bus1-7000-8000-000000000001","category":"Wholesale","created_at":"2024-01-10T10:30:00Z","credit_limit_cents":1000000,"email":"billing@acme.com","id":"019ab37c-cust-7000-8000-000000000001","name":"Acme Corporation","phone":"(555) 123-4567","status":"active","stripe_customer_id":"cus_Abc123XYZ","tax_id":"12-3456789","updated_at":"2024-01-15T14:00:00Z","website":"https://acme.com"}},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}},"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Token","description":"API token authentication. Format: `Bearer dz_...`"}}},"security":[{"BearerAuth":[]}]}