{"openapi":"3.1.0","info":{"title":"PUT /api/v1/credit/merchant-profile","version":"1.0.0","description":"Set a merchant's profile"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/credit/merchant-profile":{"put":{"tags":["credit"],"summary":"Set a merchant's profile","description":"Name the merchant as on `POST /credit/bank-feeds` (`program_id` and `external_merchant_id`, or `credit_line_id`); DayZero uses its business, creating it the first time, and gives your token read access to it. Records the merchant's start date (`business_started_on`), legal form, NAICS code, MCC, industry, country and currency. Fields left out keep what an earlier call set. `months_in_business` reads the declared start date first (`evidence.basis: declared`); without one it infers the age from the first Shopify order or bank transaction (`basis: inferred`). The currency becomes the business's while its books are empty.","operationId":"put_credit_merchant_profile","parameters":[{"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"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MerchantProfileRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_MerchantProfileResponse_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized - Missing or expired token, an MCP OAuth token used against the REST API, or no access to this business","content":{"application/json":{"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"validation_error","message":"Validation failed: amount: Input should be a valid integer","errors":{"amount":"Input should be a valid integer"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"put_credit_merchant_profile_api_v1_credit_merchant_profile_put"}}},"components":{"schemas":{"MerchantProfileRequest":{"properties":{"program_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Program Id","description":"Your program the merchant is applying under. Required without `credit_line_id`; with it, must be the line's program if sent."},"external_merchant_id":{"anyOf":[{"type":"string","maxLength":128},{"type":"null"}],"title":"External Merchant Id","description":"Your id for the merchant, as on `POST /credit/bank-feeds` and `POST /credit/lines`. Required without `credit_line_id`."},"credit_line_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Credit Line Id","description":"The merchant's open line, when there is one."},"merchant_legal_name":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Merchant Legal Name","description":"Names the merchant's DayZero business when this call creates it. Ignored when the business exists."},"merchant_business_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Merchant Business Id","description":"The merchant's existing DayZero business, when your token can reach it. Leave it out and DayZero uses the business the merchant was linked to before, or creates one."},"business_started_on":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Business Started On","description":"When the business started trading (its founding date). `months_in_business` reads it before any date it can infer from the data (`basis: declared`). Not in the future."},"legal_entity_type":{"anyOf":[{"type":"string","enum":["sole_proprietorship","partnership","llc","s_corp","c_corp","nonprofit","other"]},{"type":"null"}],"title":"Legal Entity Type","description":"The merchant's legal form."},"naics_code":{"anyOf":[{"type":"string","pattern":"^\\d{2,6}$"},{"type":"null"}],"title":"Naics Code","description":"NAICS industry code, 2 to 6 digits."},"mcc":{"anyOf":[{"type":"string","pattern":"^\\d{4}$"},{"type":"null"}],"title":"Mcc","description":"The merchant's own card-acceptance MCC, 4 digits."},"industry":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}],"title":"Industry","description":"Free-text industry, e.g. `apparel` or `restaurant`."},"country":{"anyOf":[{"type":"string","pattern":"^[A-Za-z]{2}$"},{"type":"null"}],"title":"Country","description":"ISO 3166-1 alpha-2 country the merchant trades from."},"currency":{"anyOf":[{"type":"string","pattern":"^[A-Za-z]{3}$"},{"type":"null"}],"title":"Currency","description":"ISO 4217 currency the merchant's books are kept in. Applied to the merchant's business while it holds no journal entries; after that it is recorded and `currency_applied` is false."}},"additionalProperties":false,"type":"object","title":"MerchantProfileRequest","description":"The merchant's profile: when it started, what it is, where it trades."},"MerchantProfileResponse":{"properties":{"merchant_business_id":{"type":"string","title":"Merchant Business Id","description":"The merchant's DayZero business (the assessment subject)."},"merchant_business_created":{"type":"boolean","title":"Merchant Business Created","description":"Whether this call created the business.","default":false},"business_started_on":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Business Started On","description":"The declared start date."},"legal_entity_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Legal Entity Type","description":"The declared legal form."},"naics_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Naics Code","description":"The NAICS code."},"mcc":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Mcc","description":"The merchant's MCC."},"industry":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Industry","description":"The industry."},"country":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Country","description":"The country."},"currency":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Currency","description":"The declared currency."},"currency_applied":{"type":"boolean","title":"Currency Applied","description":"Whether the business's currency is the declared one. False when its books already held entries in another currency.","default":false},"declared_at":{"type":"string","format":"date-time","title":"Declared At","description":"When this profile was pushed, UTC."}},"type":"object","required":["merchant_business_id","declared_at"],"title":"MerchantProfileResponse","description":"The profile as DayZero holds it after the push."},"SuccessEnvelope_MerchantProfileResponse_":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"},"data":{"anyOf":[{"$ref":"#/components/schemas/MerchantProfileResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[MerchantProfileResponse]"},"ErrorResponse":{"title":"ErrorResponse","type":"object","description":"Envelope returned by every non-2xx response. Branch on `code` (stable) rather than `message` (human-readable, may change).","required":["error","message","code"],"properties":{"error":{"type":"string","description":"Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`."},"message":{"type":"string","description":"Human-readable explanation, safe to show to end users."},"code":{"type":"string","description":"Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`)."},"request_id":{"type":"string","description":"Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied."},"errors":{"type":"object","additionalProperties":{"type":"string"},"description":"Field-level validation messages keyed by field name. Present on 400/422 validation failures only."}}}},"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Token","description":"API token authentication. Format: `Bearer dz_...`"}}},"security":[{"BearerAuth":[]}]}