{"openapi":"3.1.0","info":{"title":"POST /api/v1/credit/lines/{credit_line_id}/cards/stripe-issuing/connect","version":"1.0.0","description":"Provision or update a credit line's Stripe Connect Issuing account and CreditPolicy"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/credit/lines/{credit_line_id}/cards/stripe-issuing/connect":{"post":{"tags":["credit"],"summary":"Provision or update a credit line's Stripe Connect Issuing account and CreditPolicy","description":"Creates or updates a Stripe Custom connected account (`card_issuing` + `transfers` + optional `funding_credit`) for a merchant credit line, generates an `account_onboarding` link when `return_url` and `refresh_url` are supplied, and optionally activates a Stripe Issuing Credit `CreditPolicy` or records a `FundingObligation` repayment. Accounts must belong to the business and per-line accounts must match this line. Omitted accounts reuse an existing line account or create one idempotently. Onboarding URLs must use the configured app origin. Live business operator action (an API token receives `403`); sandbox businesses are refused before Stripe calls.","operationId":"provision_line_stripe_issuing_connect","parameters":[{"name":"credit_line_id","in":"path","required":true,"schema":{"type":"string","description":"Credit line UUID to bind the Stripe Connect account to.","title":"Credit Line Id"},"description":"Credit line UUID to bind the Stripe Connect account to."},{"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/CreditStripeLineConnectRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_CreditStripeLineConnectResponse_"}}}},"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":"provision_line_stripe_issuing_connect_api_v1_credit_lines__credit_line_id__cards_stripe_issuing_connect_post"}}},"components":{"schemas":{"CreditStripeLineConnectRequest":{"properties":{"stripe_account_id":{"anyOf":[{"type":"string","maxLength":128},{"type":"null"}],"title":"Stripe Account Id","description":"Owned connected Stripe account ID (`acct_...`). Per-line accounts require Stripe metadata matching this business and this line. Omit to reuse a verified existing line account, recover one after a failed save, or create a Custom account with a stable per-business/per-line idempotency key. Editable issuer_config alone is not ownership proof; `platform` is refused."},"country":{"type":"string","maxLength":4,"title":"Country","description":"Two-letter country code for a newly created connected account.","default":"US"},"enable_funding_credit":{"type":"boolean","title":"Enable Funding Credit","description":"Also request the `funding_credit` capability (Charge Card beta) on the connected account.","default":false},"return_url":{"anyOf":[{"type":"string","maxLength":2048},{"type":"null"}],"title":"Return Url","description":"Return URL for Stripe-hosted onboarding. Supply with refresh_url; both must use the configured product-app origin (scheme, host and port), without credentials or fragments. Validated before Stripe mutations."},"refresh_url":{"anyOf":[{"type":"string","maxLength":2048},{"type":"null"}],"title":"Refresh Url","description":"Refresh URL for Stripe-hosted onboarding. Supply with return_url; both must use the configured product-app origin (scheme, host and port), without credentials or fragments. Validated before Stripe mutations."},"activate_credit_policy":{"type":"boolean","title":"Activate Credit Policy","description":"Configure and activate the connected account's `CreditPolicy` (`POST /v1/issuing/credit_policy`).","default":false},"credit_limit_cents":{"anyOf":[{"type":"integer","minimum":1.0},{"type":"null"}],"title":"Credit Limit Cents","description":"Override credit limit in cents for `CreditPolicy`; defaults to the credit line's limit."},"days_until_due":{"type":"integer","maximum":90.0,"minimum":0.0,"title":"Days Until Due","description":"Days until due after the credit period ends on the `CreditPolicy`.","default":0},"funding_obligation_id":{"anyOf":[{"type":"string","maxLength":128},{"type":"null"}],"title":"Funding Obligation Id","description":"Optional `FundingObligation` ID (`ifo_...`) to record a repayment against."},"pay_amount_cents":{"anyOf":[{"type":"integer","minimum":1.0},{"type":"null"}],"title":"Pay Amount Cents","description":"Repayment amount in cents to record on `funding_obligation_id` (`/pay`)."}},"additionalProperties":false,"type":"object","title":"CreditStripeLineConnectRequest","description":"Live-business operator provisioning for an owned credit line.\n\nSandbox businesses are refused before provider calls. Platform accounts\ncannot be attached through this endpoint."},"CreditStripeLineConnectResponse":{"properties":{"credit_line_id":{"type":"string","title":"Credit Line Id","description":"Credit line UUID the Stripe Connect account is bound to."},"stripe_account_id":{"type":"string","title":"Stripe Account Id","description":"Connected Stripe account ID (`acct_...`)."},"card_issuing_capability":{"type":"string","title":"Card Issuing Capability","description":"Status of the `card_issuing` capability on the connected account."},"transfers_capability":{"type":"string","title":"Transfers Capability","description":"Status of the `transfers` capability on the connected account."},"funding_credit_capability":{"type":"string","title":"Funding Credit Capability","description":"Status of the `funding_credit` capability on the connected account.","default":"unrequested"},"currently_due_requirements":{"items":{"type":"string"},"type":"array","title":"Currently Due Requirements","description":"Onboarding requirements currently due on the connected account."},"onboarding_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Onboarding Url","description":"Stripe-hosted `account_onboarding` link when `return_url` and `refresh_url` were supplied."},"credit_policy_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Credit Policy Status","description":"Status of the connected account's `CreditPolicy` when `activate_credit_policy` was requested."},"funding_obligation_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Funding Obligation Status","description":"Status of the `FundingObligation` when `funding_obligation_id` and `pay_amount_cents` were supplied."}},"type":"object","required":["credit_line_id","stripe_account_id","card_issuing_capability","transfers_capability"],"title":"CreditStripeLineConnectResponse","description":"Result of provisioning or updating a credit line's Stripe Connect Issuing account."},"SuccessEnvelope_CreditStripeLineConnectResponse_":{"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/CreditStripeLineConnectResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[CreditStripeLineConnectResponse]"},"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":[]}]}