# hmrc/vat-api architecture

> Architecture diagram of the GitHub repository hmrc/vat-api, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hmrc/vat-api
- Repository: https://github.com/hmrc/vat-api

## Overview

vat-api exposes authenticated VAT customer and return operations, including obligations, returns, payments, liabilities, penalties, financial details, customer information, and an internal return-assistance/validation operation. The main request path is an API caller to an endpoint controller, through authorisation and request parsing, into a domain service and downstream integration; return submission additionally involves NRS and audit. README capabilities are included, but most endpoint implementations and connector calls were not excerpted, so uncertain links are omitted or marked dashed.

Main entry points: [`app/v1/services/AuditService.scala`](https://github.com/hmrc/vat-api/blob/main/app/v1/services/AuditService.scala) (Audit service), [`app/v1/controllers/SubmitReturnController.scala`](https://github.com/hmrc/vat-api/blob/main/app/v1/controllers/SubmitReturnController.scala) (Submit return), [`app/v1/controllers/CustomerInfoController.scala`](https://github.com/hmrc/vat-api/blob/main/app/v1/controllers/CustomerInfoController.scala) (Customer info), [`app/v1/controllers/ObligationsController.scala`](https://github.com/hmrc/vat-api/blob/main/app/v1/controllers/ObligationsController.scala) (Obligations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API entry"]
  node_customer["Customer info"]
  node_obligations["Obligations"]
  node_submit["Submit return"]
  node_view["View return"]
  node_payments["Payments"]
  node_liabilities["Liabilities"]
  node_penalties["Penalties"]
  node_financial["Financial details"]
  node_assist["Assist return"]
end

subgraph group_domain["VAT operations"]
  node_customer_svc["Customer service"]
  node_obligations_svc["Obligations service"]
  node_submit_svc["Submit service"]
  node_view_svc["View service"]
  node_payments_svc["Payments service"]
  node_liabilities_svc["Liabilities service"]
  node_penalties_svc["Penalties service"]
  node_financial_svc["Financial data service"]
  node_assist_svc["Assist service"]
end

subgraph group_integration["External services"]
  node_nrs_svc["NRS service<br/>[NrsService.scala]"]
  node_nrs_connector["NRS connector<br/>[NrsConnector.scala]"]
  node_des{{"DES services"}}
  node_audit_system{{"Audit system"}}
  node_auth_provider{{"Auth provider"}}
end

subgraph group_crosscut["Security and audit"]
  node_auth["Request authorisation"]
  node_authservice["Enrolment auth"]
  node_audit_svc["Audit service<br/>[AuditService.scala]"]
  node_audit_events["Audit events<br/>[AuditEvents.scala]"]
end

node_caller(("API caller"))

node_caller -->|"requests info"| node_customer
node_caller -->|"requests obligations"| node_obligations
node_caller -->|"submits return"| node_submit
node_caller -->|"requests returns"| node_view
node_caller -->|"requests payments"| node_payments
node_caller -->|"requests liabilities"| node_liabilities
node_caller -->|"requests penalties"| node_penalties
node_caller -->|"requests details"| node_financial
node_caller -->|"validates submission"| node_assist
node_auth -->|"authorises"| node_authservice
node_customer -->|"calls service"| node_customer_svc
node_obligations -->|"calls service"| node_obligations_svc
node_submit -->|"calls service"| node_submit_svc
node_view -.->|"calls service"| node_view_svc
node_payments -->|"calls service"| node_payments_svc
node_liabilities -->|"calls service"| node_liabilities_svc
node_penalties -.->|"calls service"| node_penalties_svc
node_financial -.->|"calls service"| node_financial_svc
node_assist -->|"calls service"| node_assist_svc
node_assist_svc -->|"retrieves obligations"| node_obligations_svc
node_submit -->|"submits NRS data"| node_nrs_svc
node_nrs_svc -->|"sends submission"| node_nrs_connector
node_nrs_svc -->|"audits submission"| node_audit_svc
node_customer -->|"records audit"| node_audit_svc
node_obligations -->|"records audit"| node_audit_svc
node_submit -->|"records audit"| node_audit_svc
node_audit_svc -.->|"sends events"| node_audit_system
node_audit_events -.->|"provides events"| node_audit_svc
node_authservice -.->|"checks identity"| node_auth_provider
node_customer_svc -.->|"fetches customer"| node_des
node_obligations_svc -.->|"fetches obligations"| node_des
node_submit_svc -.->|"submits return"| node_des
node_view_svc -.->|"fetches return"| node_des
node_payments_svc -.->|"fetches payments"| node_des
node_liabilities_svc -.->|"fetches liabilities"| node_des
node_penalties_svc -.->|"fetches penalties"| node_des
node_financial_svc -.->|"fetches details"| node_des

click node_customer "https://github.com/hmrc/vat-api/blob/main/app/v1/controllers/CustomerInfoController.scala"
click node_obligations "https://github.com/hmrc/vat-api/blob/main/app/v1/controllers/ObligationsController.scala"
click node_submit "https://github.com/hmrc/vat-api/blob/main/app/v1/controllers/SubmitReturnController.scala"
click node_view "https://github.com/hmrc/vat-api/blob/main/app/v1/controllers/ViewReturnController.scala"
click node_payments "https://github.com/hmrc/vat-api/blob/main/app/v1/controllers/PaymentsController.scala"
click node_liabilities "https://github.com/hmrc/vat-api/blob/main/app/v1/controllers/LiabilitiesController.scala"
click node_penalties "https://github.com/hmrc/vat-api/blob/main/app/v1/controllers/PenaltiesController.scala"
click node_financial "https://github.com/hmrc/vat-api/blob/main/app/v1/controllers/FinancialDataController.scala"
click node_assist "https://github.com/hmrc/vat-api/blob/main/app/v1/controllers/internal/AssistReturnController.scala"
click node_auth "https://github.com/hmrc/vat-api/blob/main/app/v1/controllers/AuthorisedController.scala"
click node_authservice "https://github.com/hmrc/vat-api/blob/main/app/v1/services/EnrolmentsAuthService.scala"
click node_customer_svc "https://github.com/hmrc/vat-api/blob/main/app/v1/services/CustomerInfoService.scala"
click node_obligations_svc "https://github.com/hmrc/vat-api/blob/main/app/v1/services/ObligationsService.scala"
click node_submit_svc "https://github.com/hmrc/vat-api/blob/main/app/v1/services/SubmitReturnService.scala"
click node_view_svc "https://github.com/hmrc/vat-api/blob/main/app/v1/services/ViewReturnService.scala"
click node_payments_svc "https://github.com/hmrc/vat-api/blob/main/app/v1/services/PaymentsService.scala"
click node_liabilities_svc "https://github.com/hmrc/vat-api/blob/main/app/v1/services/LiabilitiesService.scala"
click node_penalties_svc "https://github.com/hmrc/vat-api/blob/main/app/v1/services/PenaltiesService.scala"
click node_financial_svc "https://github.com/hmrc/vat-api/blob/main/app/v1/services/PenaltiesService.scala"
click node_assist_svc "https://github.com/hmrc/vat-api/blob/main/app/v1/services/AssistReturnService.scala"
click node_audit_svc "https://github.com/hmrc/vat-api/blob/main/app/v1/services/AuditService.scala"
click node_audit_events "https://github.com/hmrc/vat-api/blob/main/app/v1/audit/AuditEvents.scala"
click node_nrs_svc "https://github.com/hmrc/vat-api/blob/main/app/v1/nrs/NrsService.scala"
click node_nrs_connector "https://github.com/hmrc/vat-api/blob/main/app/v1/nrs/NrsConnector.scala"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_customer,node_obligations,node_submit,node_view,node_payments,node_liabilities,node_penalties,node_financial,node_assist toneBlue
class node_customer_svc,node_obligations_svc,node_submit_svc,node_view_svc,node_payments_svc,node_liabilities_svc,node_penalties_svc,node_financial_svc,node_assist_svc toneAmber
class node_nrs_svc,node_nrs_connector,node_des,node_audit_system,node_auth_provider,node_caller toneMint
class node_auth,node_authservice,node_audit_svc,node_audit_events toneRose
```

## Components

### API entry

- [Customer info](https://github.com/hmrc/vat-api/blob/main/app/v1/controllers/CustomerInfoController.scala): `app/v1/controllers/CustomerInfoController.scala`
- [Obligations](https://github.com/hmrc/vat-api/blob/main/app/v1/controllers/ObligationsController.scala): `app/v1/controllers/ObligationsController.scala`
- [Submit return](https://github.com/hmrc/vat-api/blob/main/app/v1/controllers/SubmitReturnController.scala): `app/v1/controllers/SubmitReturnController.scala`
- [View return](https://github.com/hmrc/vat-api/blob/main/app/v1/controllers/ViewReturnController.scala): `app/v1/controllers/ViewReturnController.scala`
- [Payments](https://github.com/hmrc/vat-api/blob/main/app/v1/controllers/PaymentsController.scala): `app/v1/controllers/PaymentsController.scala`
- [Liabilities](https://github.com/hmrc/vat-api/blob/main/app/v1/controllers/LiabilitiesController.scala): `app/v1/controllers/LiabilitiesController.scala`
- [Penalties](https://github.com/hmrc/vat-api/blob/main/app/v1/controllers/PenaltiesController.scala): `app/v1/controllers/PenaltiesController.scala`
- [Financial details](https://github.com/hmrc/vat-api/blob/main/app/v1/controllers/FinancialDataController.scala): `app/v1/controllers/FinancialDataController.scala`
- [Assist return](https://github.com/hmrc/vat-api/blob/main/app/v1/controllers/internal/AssistReturnController.scala): `app/v1/controllers/internal/AssistReturnController.scala`

### VAT operations

- [Customer service](https://github.com/hmrc/vat-api/blob/main/app/v1/services/CustomerInfoService.scala): `app/v1/services/CustomerInfoService.scala`
- [Obligations service](https://github.com/hmrc/vat-api/blob/main/app/v1/services/ObligationsService.scala): `app/v1/services/ObligationsService.scala`
- [Submit service](https://github.com/hmrc/vat-api/blob/main/app/v1/services/SubmitReturnService.scala): `app/v1/services/SubmitReturnService.scala`
- [View service](https://github.com/hmrc/vat-api/blob/main/app/v1/services/ViewReturnService.scala): `app/v1/services/ViewReturnService.scala`
- [Payments service](https://github.com/hmrc/vat-api/blob/main/app/v1/services/PaymentsService.scala): `app/v1/services/PaymentsService.scala`
- [Liabilities service](https://github.com/hmrc/vat-api/blob/main/app/v1/services/LiabilitiesService.scala): `app/v1/services/LiabilitiesService.scala`
- [Penalties service](https://github.com/hmrc/vat-api/blob/main/app/v1/services/PenaltiesService.scala): `app/v1/services/PenaltiesService.scala`
- [Financial data service](https://github.com/hmrc/vat-api/blob/main/app/v1/services/PenaltiesService.scala): `app/v1/services/PenaltiesService.scala`
- [Assist service](https://github.com/hmrc/vat-api/blob/main/app/v1/services/AssistReturnService.scala): `app/v1/services/AssistReturnService.scala`

### External services

- [NRS service](https://github.com/hmrc/vat-api/blob/main/app/v1/nrs/NrsService.scala): `app/v1/nrs/NrsService.scala`
- [NRS connector](https://github.com/hmrc/vat-api/blob/main/app/v1/nrs/NrsConnector.scala): `app/v1/nrs/NrsConnector.scala`
- **DES services**
- **Audit system**
- **Auth provider**

### Security and audit

- [Request authorisation](https://github.com/hmrc/vat-api/blob/main/app/v1/controllers/AuthorisedController.scala): `app/v1/controllers/AuthorisedController.scala`
- [Enrolment auth](https://github.com/hmrc/vat-api/blob/main/app/v1/services/EnrolmentsAuthService.scala): `app/v1/services/EnrolmentsAuthService.scala`
- [Audit service](https://github.com/hmrc/vat-api/blob/main/app/v1/services/AuditService.scala): `app/v1/services/AuditService.scala`
- [Audit events](https://github.com/hmrc/vat-api/blob/main/app/v1/audit/AuditEvents.scala): `app/v1/audit/AuditEvents.scala`

### Other components

- **API caller**

## Connections

- API caller → Customer info: requests info (evidence: `README.md`)
- API caller → Obligations: requests obligations (evidence: `README.md`)
- API caller → Submit return: submits return (evidence: `README.md`)
- API caller → View return: requests returns (evidence: `README.md`)
- API caller → Payments: requests payments (evidence: `README.md`)
- API caller → Liabilities: requests liabilities (evidence: `README.md`)
- API caller → Penalties: requests penalties (evidence: `README.md`)
- API caller → Financial details: requests details (evidence: `README.md`)
- API caller → Assist return: validates submission (evidence: `README.md`)
- Request authorisation → Enrolment auth: authorises (evidence: `app/v1/controllers/AuthorisedController.scala`)
- Customer info → Customer service: calls service (evidence: `app/v1/controllers/CustomerInfoController.scala`)
- Obligations → Obligations service: calls service (evidence: `app/v1/controllers/ObligationsController.scala`)
- Submit return → Submit service: calls service (evidence: `app/v1/controllers/SubmitReturnController.scala`)
- View return → View service: calls service
- Payments → Payments service: calls service (evidence: `app/v1/controllers/PaymentsController.scala`)
- Liabilities → Liabilities service: calls service (evidence: `app/v1/controllers/LiabilitiesController.scala`)
- Penalties → Penalties service: calls service
- Financial details → Financial data service: calls service
- Assist return → Assist service: calls service (evidence: `app/v1/controllers/internal/AssistReturnController.scala`)
- Assist service → Obligations service: retrieves obligations (evidence: `app/v1/services/AssistReturnService.scala`)
- Submit return → NRS service: submits NRS data (evidence: `app/v1/controllers/SubmitReturnController.scala`)
- NRS service → NRS connector: sends submission (evidence: `app/v1/nrs/NrsService.scala`)
- NRS service → Audit service: audits submission (evidence: `app/v1/nrs/NrsService.scala`)
- Customer info → Audit service: records audit (evidence: `app/v1/controllers/CustomerInfoController.scala`)
- Obligations → Audit service: records audit (evidence: `app/v1/controllers/ObligationsController.scala`)
- Submit return → Audit service: records audit (evidence: `app/v1/controllers/SubmitReturnController.scala`)
- Audit service → Audit system: sends events
- Audit events → Audit service: provides events
- Enrolment auth → Auth provider: checks identity
- Customer service → DES services: fetches customer
- Obligations service → DES services: fetches obligations
- Submit service → DES services: submits return
- View service → DES services: fetches return
- Payments service → DES services: fetches payments
- Liabilities service → DES services: fetches liabilities
- Penalties service → DES services: fetches penalties
- Financial data service → DES services: fetches details
