{
  "openapi": "3.1.0",
  "info": {
    "title": "Credicorp Partner Sandbox API",
    "version": "2026-08-11.1",
    "description": "Isolated deterministic integration environment. It never accesses production customers, lending, banking, identity, Companies House, or webhooks."
  },
  "servers": [{"url": "https://sandbox.credicorp.co.uk"}],
  "paths": {
    "/healthz": {"get": {"operationId": "health", "responses": {"200": {"description": "Database and service available"}}}},
    "/oauth/token": {"post": {"operationId": "token", "requestBody": {"required": true, "content": {"application/x-www-form-urlencoded": {"schema": {"type": "object", "required": ["grant_type"], "properties": {"grant_type": {"const": "client_credentials"}, "scope": {"type": "string"}}}}}}, "responses": {"200": {"description": "Opaque scoped bearer token"}, "400": {"$ref": "#/components/responses/Problem"}, "401": {"$ref": "#/components/responses/Problem"}}}},
    "/v1/fixtures": {"get": {"operationId": "fixtures", "security": [{"sandboxBearer": ["sandbox:read"]}], "responses": {"200": {"description": "Versioned synthetic fixtures"}, "401": {"$ref": "#/components/responses/Problem"}, "403": {"$ref": "#/components/responses/Problem"}}}},
    "/v1/applications": {"post": {"operationId": "createApplication", "security": [{"sandboxBearer": ["sandbox:write"]}], "parameters": [{"$ref": "#/components/parameters/IdempotencyKey"}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "required": ["business", "amount_pence"], "properties": {"business": {"type": "object", "required": ["company_number"], "properties": {"company_number": {"type": "string", "pattern": "^[0-9]{8}$"}}}, "amount_pence": {"type": "integer", "minimum": 5000, "maximum": 250000000}}}}}}, "responses": {"201": {"description": "Synthetic application and deterministic decision"}, "409": {"$ref": "#/components/responses/Problem"}, "422": {"$ref": "#/components/responses/Problem"}}}},
    "/v1/applications/{id}": {"get": {"operationId": "getApplication", "security": [{"sandboxBearer": ["sandbox:read"]}], "parameters": [{"$ref": "#/components/parameters/ApplicationId"}], "responses": {"200": {"description": "Owned synthetic application"}, "404": {"$ref": "#/components/responses/Problem"}}}},
    "/v1/applications/{id}/accept": {"post": {"operationId": "acceptApplication", "security": [{"sandboxBearer": ["sandbox:write"]}], "parameters": [{"$ref": "#/components/parameters/ApplicationId"}, {"$ref": "#/components/parameters/IdempotencyKey"}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "required": ["bank_account"], "properties": {"bank_account": {"enum": ["bank_settle", "bank_fail"]}}}}}}, "responses": {"200": {"description": "Synthetic acceptance and funding outcome"}, "409": {"$ref": "#/components/responses/Problem"}}}},
    "/v1/payments": {"post": {"operationId": "createRepayment", "security": [{"sandboxBearer": ["sandbox:write"]}], "parameters": [{"$ref": "#/components/parameters/IdempotencyKey"}], "responses": {"201": {"description": "Synthetic repayment outcome"}, "409": {"$ref": "#/components/responses/Problem"}}}},
    "/v1/webhook-endpoints": {"post": {"operationId": "createWebhookEndpoint", "security": [{"sandboxBearer": ["sandbox:write"]}], "parameters": [{"$ref": "#/components/parameters/IdempotencyKey"}], "responses": {"201": {"description": "Webhook endpoint and one-time signing secret"}, "422": {"$ref": "#/components/responses/Problem"}}}},
    "/v1/events": {"get": {"operationId": "listEvents", "security": [{"sandboxBearer": ["sandbox:read"]}], "responses": {"200": {"description": "Owned durable synthetic events"}}}},
    "/v1/events/{id}/replay": {"post": {"operationId": "replayEvent", "security": [{"sandboxBearer": ["sandbox:write"]}], "parameters": [{"$ref": "#/components/parameters/EventId"}, {"$ref": "#/components/parameters/IdempotencyKey"}], "responses": {"202": {"description": "Replay delivery attempted synchronously"}, "404": {"$ref": "#/components/responses/Problem"}}}}
  },
  "components": {
    "securitySchemes": {"sandboxBearer": {"type": "http", "scheme": "bearer", "bearerFormat": "opaque", "description": "Obtain with client_credentials at /oauth/token. Tokens are sandbox-only."}},
    "parameters": {
      "IdempotencyKey": {"in": "header", "name": "Idempotency-Key", "required": true, "schema": {"type": "string", "minLength": 8, "maxLength": 128}, "description": "Stable per-client key. Reuse with identical request returns the original response; a different request returns 409."},
      "ApplicationId": {"in": "path", "name": "id", "required": true, "schema": {"type": "string", "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$"}},
      "EventId": {"in": "path", "name": "id", "required": true, "schema": {"type": "string", "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$"}}
    },
    "responses": {"Problem": {"description": "Truthful non-success response", "content": {"application/json": {"schema": {"type": "object", "required": ["error"], "properties": {"error": {"type": "object", "required": ["code", "message", "request_id"]}}}}}}}
  }
}
