swagger: "2.0" info: description: "Demo object oriented web application: create accounts and transfer money between them via a RESTful API." version: "0.0.1" title: "Accounts and Transfers" basePath: "/" tags: - name: "accounts" - name: "transfers" schemes: - "http" paths: /accounts: post: tags: - "accounts" summary: "Open a new account." description: "" consumes: - "application/json" produces: - "application/json" parameters: - in: "body" name: "body" description: "Account body" required: true schema: $ref: "#/definitions/AccountPost" responses: 201: description: "successful operation" schema: $ref: "#/definitions/AccountGet" 400: description: "Invalid input" /accounts/{id}: get: tags: - "accounts" summary: "Find account by ID" description: "Returns a single account." produces: - "application/json" parameters: - name: "id" in: "path" description: "UUID of account to return." required: true type: "integer" format: "uuid" responses: 200: description: "successful operation" schema: $ref: "#/definitions/AccountGet" 400: description: "Invalid ID supplied" 404: description: "Account not found" /transfers: post: tags: - "transfers" summary: "Execute a transfer between accounts" description: "This operation is idempotent. An idempotency key (header 'x-idempotency-key') is used to guard against the execution of duplicate transfers. The request is treated as idempotent if a request from this client (header `x-client-id`) with the same idempotency key has already been executed." produces: - "application/json" parameters: - in: "header" name: "x-client-id" description: "Every request will be processed only once per x-idempotency-key. The Idempotency Key will be valid for 24 hours." required: true type: string - in: "header" name: "x-idempotency-key" description: "Every request will be processed only once per x-idempotency-key. The Idempotency Key will be valid for 24 hours." required: true type: string - in: "body" name: "body" required: true schema: $ref: "#/definitions/TransferPost" responses: default: description: "successful operation" definitions: AccountPost: type: "object" required: - "iban" - "currency" properties: iban: type: "string" format: "IBAN" description: "Example: DE89370400440532666000" currency: type: "string" description: "Example: 'EUR'" xml: name: "AccountPost" AccountGet: type: "object" required: - "iban" - "currency" - "balance" properties: iban: type: "string" format: "IBAN" description: "Example: DE89370400440532666000" currency: type: "string" description: "Example: 'EUR'" balance: $ref: "#/definitions/Amount" xml: name: "AccountPost" TransferPost: type: "object" required: - "debtor" - "creditor" - "instructedAmount" properties: debtor: type: "string" format: "IBAN" description: "Example: DE89370400440532666000" creditor: type: "string" format: "IBAN" description: "Example: DE89370400440532666000" instructedAmount: $ref: "#/definitions/Amount" xml: name: "TransferPost" Amount: type: "object" required: - "amount" - "currency" properties: amount: type: "string" format: "int32" description: "Example: '10.15'" currency: type: "string" description: "Example: 'EUR'" externalDocs: description: "Find out more about Swagger" url: "http://swagger.io"