{"openapi":"3.1.0","info":{"title":"PATCH /api/v1/loans/{instrument_id}/counterparty","version":"1.0.0","description":"Re-tag a loan's counterparty type"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/loans/{instrument_id}/counterparty":{"patch":{"tags":["loans"],"summary":"Re-tag a loan's counterparty type","description":"Re-tag the counterparty classification of a loan.\n\n**Request Body:**\n- `counterparty_type`: One of `customer`, `vendor`, `shareholder`,\n  `employee`, `affiliate`, `other`.\n\nDrives subledger grouping and shareholder-loan reporting.","operationId":"update_loan_counterparty_api_v1_loans__instrument_id__counterparty_patch","parameters":[{"name":"instrument_id","in":"path","required":true,"schema":{"type":"string","title":"Instrument Id"}},{"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/LoanCounterpartyUpdateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_LoanCounterpartyUpdateResponse_"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"detail":"Resource not found"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"LoanCounterpartyTypeEnum":{"type":"string","enum":["customer","vendor","shareholder","employee","affiliate","other"],"title":"LoanCounterpartyTypeEnum","description":"Who the counterparty is, for subledger grouping and reporting.\n\nLets one business run many loans against distinct counterparties\n(e.g. 20 borrowing clients, each with their own subledger) and\nsurfaces dedicated reporting buckets such as shareholder loans."},"LoanCounterpartyUpdateRequest":{"properties":{"counterparty_type":{"$ref":"#/components/schemas/LoanCounterpartyTypeEnum"}},"additionalProperties":false,"type":"object","required":["counterparty_type"],"title":"LoanCounterpartyUpdateRequest","description":"Re-tag the counterparty classification of a loan."},"LoanCounterpartyUpdateResponse":{"properties":{"instrument_id":{"type":"string","title":"Instrument Id"},"counterparty_type":{"type":"string","title":"Counterparty Type"}},"type":"object","required":["instrument_id","counterparty_type"],"title":"LoanCounterpartyUpdateResponse","description":"Outcome of a counterparty re-tag."},"SuccessEnvelope_LoanCounterpartyUpdateResponse_":{"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/LoanCounterpartyUpdateResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[LoanCounterpartyUpdateResponse]"},"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":[]}]}