{ "openapi": "3.0.3", "info": { "title": "42C Bank API", "description": "An intentionally insecure banking API for education and training purposes", "contact": { "name": "42Crunch Support", "url": "https://support.42crunch.com", "email": "support@42crunch.com" }, "version": "1.0.0" }, "servers": [ { "url": "https://cute-noble-boar.ngrok-free.app/apis/banking/v1" } ], "security": [ { "AccessToken": [] } ], "x-42c-accept-empty-security": true, "paths": { "/auth/register": { "post": { "description": "create an account", "operationId": "AccountRegister", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "$ref": "#/components/schemas/Name" }, "email": { "$ref": "#/components/schemas/Email" }, "postalAddress": { "$ref": "#/components/schemas/Address" }, "pan": { "$ref": "#/components/schemas/PersonalAccountNumber" } } } } } }, "security": [], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "$ref": "#/components/schemas/ResponseMessage" }, "accountId": { "$ref": "#/components/schemas/AccountId" } }, "additionalProperties": false } } } }, "default": { "$ref": "#/components/responses/DefaultErrorResponse" } } } }, "/auth/login": { "post": { "description": "Log in to the account", "operationId": "AccountLogin", "security": [], "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "email": { "$ref": "#/components/schemas/Email" }, "pan": { "$ref": "#/components/schemas/PersonalAccountNumber" } }, "additionalProperties": false } } } }, "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "object", "properties": { "access": { "type": "string", "pattern": "^/eyJ[A-Za-z0-9-_]+.eyJ[A-Za-z0-9-_]+.[A-Za-z0-9-_.+/]*$", "maxLength": 500 }, "access_expires": { "type": "integer" } }, "additionalProperties": false } } } }, "default": { "$ref": "#/components/responses/DefaultErrorResponse" } } } }, "/account": { "get": { "description": "Get a user account", "operationId": "GetAccount", "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "object", "properties": { "accountId": { "$ref": "#/components/schemas/AccountId" }, "name": { "$ref": "#/components/schemas/Name" }, "email": { "$ref": "#/components/schemas/Email" }, "address": { "$ref": "#/components/schemas/Address" } }, "additionalProperties": false } } } }, "default": { "$ref": "#/components/responses/DefaultErrorResponse" } } }, "delete": { "description": "Delete an Account", "operationId": "DeleteAccount", "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MessageObject" } } } }, "default": { "$ref": "#/components/responses/DefaultErrorResponse" } } }, "put": { "description": "Update account optional settings", "operationId": "UpdateAccount", "requestBody":{ "content": { "application/json":{ "schema":{ "$ref": "#/components/schemas/AccountOptions" } } } }, "responses": { "200": { "description": "OK", "content": { "application/json":{ "schema":{ "$ref": "#/components/schemas/AccountOptions" } } } }, "default": { "$ref": "#/components/responses/DefaultErrorResponse" } } } }, "/account/balances": { "get": { "description": "Get Account balances", "operationId": "GetAccountBalances", "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "object", "properties": { "accountId": { "$ref": "#/components/schemas/AccountId" }, "balance": { "$ref": "#/components/schemas/BalanceAmount" }, "currency": { "$ref": "#/components/schemas/Currency" } }, "additionalProperties": false } } } }, "default": { "$ref": "#/components/responses/DefaultErrorResponse" } } } }, "/account/transactions": { "get": { "description": "Get Account Transactions", "operationId": "GetAccountTransactions", "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "object", "properties": { "txnId": { "type": "string", "format": "uuid", "example": "a83a29f5-0d63-46f2-8f2e-44c2f1d2e07e", "pattern": "^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$", "minLength": 36, "maxLength": 36, "x-42c-format": "o:uuid" }, "txnType": { "type": "string", "enum": [ "funds transfer", "bill payment" ] }, "name": { "$ref": "#/components/schemas/Name" }, "accountNumber": { "$ref": "#/components/schemas/UtilityAccountId" }, "iban": { "$ref": "#/components/schemas/IBAN" }, "amount": { "$ref": "#/components/schemas/TransferAmount" }, "currency": { "$ref": "#/components/schemas/Currency" }, "description": { "type": "string", "pattern": "^[A-Za-z0-9 _.,!\"?]{0,100}$" } }, "additionalProperties": false } } } } }, "default": { "$ref": "#/components/responses/DefaultErrorResponse" } } }, "head": { "description": "Get Account Transactions Headers", "operationId": "GetAccountTransactionsHeaders", "responses": { "200": { "description": "No content" }, "default": { "$ref": "#/components/responses/NoContentErrorResponse" } } } }, "/account/products/cards": { "post": { "description": "Apply for a credit card", "operationId": "CreateCardApplication", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "delivery": { "$ref": "#/components/schemas/DeliveryType" } }, "additionalProperties": false } } } }, "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "$ref": "#/components/schemas/ResponseMessage" }, "referenceId": { "type": "number" } }, "additionalProperties": false } } }, "headers": { "X-Rate-Limit-Limit": { "description": "The number of allowed requests in the current period" } } }, "default": { "$ref": "#/components/responses/DefaultErrorResponse" } } }, "get": { "description": "Get credit card application", "operationId": "GetCardApplication", "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "object", "properties": { "_id": { "type": "number" }, "name": { "$ref": "#/components/schemas/Name" }, "delivery": { "$ref": "#/components/schemas/DeliveryType" }, "address": { "$ref": "#/components/schemas/Address" }, "status": { "$ref": "#/components/schemas/CardStatus" } }, "additionalProperties": false } } } }, "default": { "$ref": "#/components/responses/DefaultErrorResponse" } } } }, "/account/products/cards/{referenceId}": { "put": { "description": "Update the delivery method and address", "operationId": "UpdateCardApplication", "parameters": [ { "$ref": "#/components/parameters/referenceId" } ], "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "delivery": { "$ref": "#/components/schemas/DeliveryType" }, "postalAddress": { "$ref": "#/components/schemas/Address" } }, "additionalProperties": false } } } }, "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "object", "properties": { "_id": { "type": "number" }, "name": { "$ref": "#/components/schemas/Name" }, "delivery": { "$ref": "#/components/schemas/DeliveryType" }, "address": { "$ref": "#/components/schemas/Address" }, "status": { "$ref": "#/components/schemas/CardStatus" } }, "additionalProperties": false } } } }, "default": { "$ref": "#/components/responses/DefaultErrorResponse" } } }, "delete": { "description": "Cancel a credit card application", "operationId": "DeleteCardApplication", "parameters": [ { "$ref": "#/components/parameters/referenceId" } ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "$ref": "#/components/schemas/ResponseMessage" } }, "additionalProperties": false } } } }, "default": { "$ref": "#/components/responses/DefaultErrorResponse" } } } }, "/account/payees": { "get": { "description": "Get list of payees", "operationId": "GetAccountPayees", "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "array", "maxItems": 10, "items": { "oneOf": [ { "$ref": "#/components/schemas/UtilityPayee" }, { "$ref": "#/components/schemas/ContactPayee" } ], "discriminator": { "propertyName": "payeeType" } } } } } }, "default": { "$ref": "#/components/responses/DefaultErrorResponse" } } }, "post": { "description": "Add new payee", "operationId": "CreatePayee", "requestBody": { "content": { "application/json": { "schema": { "oneOf": [ { "$ref": "#/components/schemas/UtilityPayee" }, { "$ref": "#/components/schemas/ContactPayee" } ], "discriminator": { "propertyName": "payeeType" } } } } }, "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type":"object", "properties":{ "message":{ "$ref": "#/components/schemas/ResponseMessage" }, "payeeId":{ "$ref": "#/components/schemas/AccountId" } }, "additionalProperties": false } } } }, "default": { "$ref": "#/components/responses/DefaultErrorResponse" } } } }, "/account/payees/{payeeId}": { "delete": { "description": "Delete a payee from the payee list", "operationId": "DeletePayee", "parameters": [ { "$ref": "#/components/parameters/payeeId" } ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MessageObject" } } } }, "401": { "$ref": "#/components/responses/401ErrorResponse" } } } }, "/account/payments/transfer": { "post": { "description": "Create a payment to make a fund transfer.", "operationId": "CreateTransferPayment", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "accountId":{ "$ref": "#/components/schemas/AccountId" }, "name": { "$ref": "#/components/schemas/Name" }, "iban": { "$ref": "#/components/schemas/IBAN" }, "amount": { "$ref": "#/components/schemas/TransferAmount" }, "currency": { "$ref": "#/components/schemas/Currency" }, "description": { "type": "string", "pattern": "^[A-Za-z0-9 _.,!\"?]{0,100}$", "example": "rent payment" } }, "required": [ "accountId", "name", "iban", "amount", "currency" ], "additionalProperties": false } } } }, "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "object", "properties": { "transactionId": { "$ref": "#/components/schemas/TransactionId" }, "message": { "$ref": "#/components/schemas/ResponseMessage" } }, "additionalProperties": false } } } }, "default": { "$ref": "#/components/responses/DefaultErrorResponse" } } } }, "/account/payments/bill": { "post": { "description": "Create a payment to pay a utility bill.", "operationId": "CreateBillPayment", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "$ref": "#/components/schemas/Utility" }, "accountNumber":{ "$ref": "#/components/schemas/UtilityAccountId" }, "amount": { "$ref": "#/components/schemas/TransferAmount" }, "currency": { "$ref": "#/components/schemas/Currency" } }, "required": [ "name", "accountNumber", "amount" ], "additionalProperties": false } } } }, "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "object", "properties": { "transactionId": { "$ref": "#/components/schemas/TransactionId" }, "message": { "$ref": "#/components/schemas/ResponseMessage" } }, "additionalProperties": false } } } }, "default": { "$ref": "#/components/responses/DefaultErrorResponse" } } } }, "/account/products/mortgages/meeting": { "post": { "description": "Reserve a meeting with a mortgage consultant", "parameters": [], "requestBody":{ "content": { "application/json":{ "schema":{ "type": "object", "properties": { "schedule": { "type": "string", "format": "date-time", "example": "2024-08-01T16:00", "pattern": "^[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12][0-9]|3[01])T(?:[01][0-9]|2[0-3]):[0-5][0-9]:(?:[0-5][0-9]|60)(?:\\.[0-9]{1,15})?(?:Z|[+\\-](?:[01][0-9]|2[0-3]):[0-5][0-9])$", "minLength": 20, "maxLength": 38, "x-42c-format": "o:date-time" } }, "required": ["schedule"], "additionalProperties": false } } } }, "responses": { "201": { "description": "Ok", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "$ref": "#/components/schemas/ResponseMessage" } }, "additionalProperties": false } } } }, "default": { "$ref": "#/components/responses/DefaultErrorResponse" } } } } }, "components": { "schemas": { "AccountId": { "description": "A unique and immutable identifier used to identify the account resource. This identifier has no meaning to the account owner.", "type": "string", "pattern": "^[a-f\\d]{24}$", "example": "661cc8464787094021349548" }, "AccountOptions": { "description": "Optional settings for a users bank account", "type": "object", "properties": { "paperStatements": { "type": "boolean", "example": false }, "cardActivityAlerts": { "type": "boolean", "example": true }, "smsNotifications": { "type": "boolean", "example": true } }, "additionalProperties": false }, "Address": { "type": "object", "properties": { "addressLine": { "items": { "type": "string", "minLength": 1, "maxLength": 70, "pattern": "^[A-Za-z0-9_,. ]{1,50}$" }, "type": "array", "description": "Information that locates and identifies a specific address, as defined by postal services, that is presented in free format text.", "minItems": 0, "maxItems": 5 }, "postCode": { "description": "Identifier consisting of a group of letters and/or numbers that is added to a postal address to assist the sorting of mail.", "type": "string", "pattern": "^[A-Za-z0-9]{1,16}$", "minLength": 1, "maxLength": 16 }, "country": { "description": "Nation with its own government, occupying a particular territory.", "type": "string", "pattern": "^[A-Z]{2,2}$" } }, "additionalProperties": false, "required": [ "postCode", "country" ], "example": { "addressLine": [ "101 Avenue de Nice", "Cagnes sur mer", "Nice" ], "postCode": "06000", "country": "FR" } }, "BalanceAmount": { "type": "number", "maximum": 1000000 }, "CardStatus": { "type": "string", "enum": [ "pending", "cancelled", "complete" ] }, "ContactPayee": { "allOf": [ { "$ref": "#/components/schemas/Payee" }, { "type": "object", "properties": { "name": { "$ref": "#/components/schemas/Name" }, "iban": { "$ref": "#/components/schemas/IBAN" } }, "required": [ "iban" ] } ], "example": { "payeeType": "contact", "name": "Lisa Laurent", "iban": "IE12BOFI90000112777777" } }, "Currency": { "description": "a list of supported currencies by currency code", "type": "string", "enum": [ "AUD", "CAD", "EUR", "GBP", "JPY", "IDR", "INR", "MYR", "SGD", "TWD", "USD" ], "example": "USD" }, "DeliveryType": { "type": "string", "enum": [ "post", "collect" ] }, "Email": { "type": "string", "format": "email-secured", "example": "jbernard@email.com", "pattern": "^\\w+(?:[\\-.]\\w+)*@[0-9A-Za-z]+(?:[\\-.][0-9A-Za-z]+)*\\.(?:[A-Za-z][0-9A-Za-z]+|[0-9]+[A-Za-z][0-9A-Za-z]*)$", "minLength": 6, "maxLength": 320, "x-42c-format": "o:email-secured" }, "IBAN": { "type": "string", "format": "o:openbanking:iban" }, "Name": { "type": "string", "description": "persons name", "pattern": "^[A-Za-z0-9. -]{1,50}$", "example": "Jean Bernard" }, "Payee": { "type": "object", "properties": { "payeeType": { "$ref": "#/components/schemas/PayeeType" } }, "required": [ "payeeType" ], "discriminator": { "propertyName": "payeeType" } }, "PayeeType": { "type": "string", "enum": [ "utility", "contact" ] }, "PersonalAccountNumber": { "type": "string", "description": "personal account number", "pattern": "^[0-9]{5,10}$", "example": "33333" }, "ResponseMessage": { "type": "string", "pattern": "^[A-Za-z0-9\/\\.\"', ]{1,100}$" }, "MessageObject": { "type": "object", "properties": { "message": { "$ref": "#/components/schemas/ResponseMessage" } }, "additionalProperties": false }, "UtilityAccountId": { "type": "string", "pattern": "^[A-Z0-9]{8,12}$", "example": "BT2221801" }, "UtilityPayee": { "allOf": [ { "$ref": "#/components/schemas/Payee" }, { "type": "object", "properties": { "name": { "$ref": "#/components/schemas/Utility" }, "accountNumber": { "$ref": "#/components/schemas/UtilityAccountId" } } } ], "example": { "payeeType": "utility", "name": "electricity bill", "accountNumber": "BT2221801" } }, "Utility": { "type": "string", "enum": [ "electricity bill", "gas bill" ], "example": "electricity bill" }, "TransactionId": { "description": "A unique and immutable identifier used to identify a payment transaction.", "type": "string", "pattern": ".*" }, "TransferAmount": { "type": "number", "format": "float", "minimum": 1.00, "maximum": 3000.00, "example": 100 } }, "responses": { "401ErrorResponse": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MessageObject" } } } }, "DefaultErrorResponse": { "description": "Unexpected Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MessageObject" } } } }, "NoContentErrorResponse": { "description": "No content" } }, "parameters": { "filename": { "name": "filename", "in": "query", "required": true, "description": "A file name", "schema": { "type": "string", "pattern": "^[a-zA-Z0-9._-]{5,256}$", "example": "bill.pdf" } }, "payeeId": { "name": "payeeId", "in": "path", "required": true, "description": "An identifier for a payee", "schema": { "$ref": "#/components/schemas/AccountId" } }, "referenceId": { "name": "referenceId", "in": "path", "required": true, "description": "An identifier for a credit card application", "schema": { "type": "integer", "format": "int32", "minimum": 0, "example": 1000 } } }, "securitySchemes": { "AccessToken": { "type": "http", "scheme": "bearer", "bearerFormat": "JWT" } } } }