{
  "openapi": "3.1.0",
  "info": { "title": "Making Tax Digital, for your own agent", "version": "1.0.0", "description": "Read and prepare one customer's quarterly update. Filing is only possible by the customer, with their passkey, in the app." },
  "components": { "securitySchemes": { "key": { "type": "http", "scheme": "bearer", "description": "An agent key from Home, starting qk_" } } },
  "security": [{ "key": [] }],
  "paths": {
    "/v1/quarter": { "get": { "summary": "The current quarter: deadlines, figures, estimate, and transactions needing an answer", "responses": { "200": { "description": "The quarter" } } } },
    "/v1/guide": { "get": { "summary": "The Making Tax Digital procedure and rules, with HMRC sources", "responses": { "200": { "description": "The guide" } } } },
    "/v1/answers": { "post": { "summary": "Answer one unclear transaction", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["transaction_id", "choice"], "properties": { "transaction_id": { "type": "string" }, "choice": { "type": "string" } } } } } }, "responses": { "200": { "description": "The updated quarter" }, "400": { "description": "Not found or not a valid choice" } } } },
    "/v1/receipts": { "post": { "summary": "Add a receipt", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["total"], "properties": { "total": { "type": "number" }, "merchant": { "type": "string" }, "date": { "type": "string", "format": "date" } } } } } }, "responses": { "200": { "description": "Matched or added as a question" } } } },
    "/v1/other-income": { "post": { "summary": "Salary or pension for the tax year, before tax", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["amount"], "properties": { "amount": { "type": "number", "minimum": 0 } } } } } }, "responses": { "200": { "description": "The updated quarter" } } } },
    "/v1/final-check": { "post": { "summary": "Run the final check. Nothing is sent to HMRC", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "note": { "type": "string" } } } } } }, "responses": { "200": { "description": "Result and points worth a look" }, "400": { "description": "Questions still unanswered, or no plan" } } } },
    "/v1/approval-request": { "post": { "summary": "Ask the customer to approve and file in the app", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } }, "responses": { "200": { "description": "Customer emailed" }, "400": { "description": "Final check not passed yet" } } } }
  }
}
