LAA Civil Applications Data Store
This is planned to be the central store of applications for Civil Legal Aid from Check if you can get Legal Aid and Check if your client qualifies for legal aid.
API Documentation
Base URL:
www.civil-case-api.cloud-platform.service.justice.gov.uk/
Authentication
To use the API you will need a JSON Web Token (JWT) which can be obtained from the /token
endpoint.
You will need to send a POST
request with the following headers:
{
"accept": "application/json",
"Content-Type": "application/x-www-form-urlencoded"
}
and body:
{
"grant_type": "password",
"username": "string",
"password": "string",
"scope": "",
"client_id": "string",
"client_secret": "string"
}
The /token
endpoint generates the required access token to allow a user to access the service. When submitting other requests, the request needs to contain this authorisation bearer token.
All access tokens are valid for 30 minutes on the API.
Access Tokens
The /token endpoint generates the required access token to allow a user to access the service. When submitting other requests, the request needs to contain this authorisation bearer token.
All access tokens are valid for 30 minutes on the API. This can be adjusted by amending ACCESS_TOKEN_EXPIRE_MINUTES on the auth/security.py file. This can be authenticated via a username and password which is compared to the hashed password in the database. As long as the user is logged in, a JWT token can be generated for their user.
Updating the Secret Key
The OAuth2 JWT encoding requires a SECRET_KEY. This can be defined in your .env file to generate unique tokens. All environments have a different secret key that defines what to be encoded against.
Adding Auth to Routes
To add authorisation to any route, simply add the below to the route definition:
shell
current_user: Users = Depends(get_current_active_user)
Hashing and Encoding
All password information is hashed and salted per argon2 and passlib. The token is then generated and encoded via JWT which uses the secret key to sign the identity of the token. This means that the token contains a header, payload and a signature following the HS256 algorithm ensuring security.
Cases
Create a case
POST /cases
A case can be created using the following request schema
{
"case_type": "CLA",
"notes": [
{
"note_type": "Operator",
"content": "Initial client contact made via phone."
},
{
"note_type": "Provider",
"content": "Case documents received and filed."
}
],
"people": [
{
"name": "John Doe",
"address": "123 St. James Avenue",
"phone_number": "012334 343495",
"postcode": "SW1A 1AA",
"email": "john.doe@example.com"
},
{
"name": "Jane Doe",
"address": "124 St. James Avenue",
"phone_number": "012334 343465",
"postcode": "SW1A 1AA",
"email": "jane.smith@example.com"
}
]
}
Arguments
Case type (required)
Case type can be either “CLA” or “CCQ”.
Notes
Note type
Note type can be one of “User”, “Provider”, “Operator”, or, “Other”
Content
A string.
Response
You will receive the following response schema:
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"case_type": "CLA",
"created_at": "2024-10-17T09:00:00Z",
"updated_at": "2024-10-17T09:00:00Z",
"notes": [
{
"id": "123e4567-e89b-12d3-a456-426614174001",
"note_type": "Operator",
"content": "Initial client contact made via phone.",
"case_id": "123e4567-e89b-12d3-a456-426614174000",
"created_at": "2024-10-17T09:00:00Z",
"updated_at": "2024-10-17T09:00:00Z"
},
{
"id": "123e4567-e89b-12d3-a456-426614174002",
"note_type": "Provider",
"content": "Case documents received and filed.",
"case_id": "123e4567-e89b-12d3-a456-426614174000",
"created_at": "2024-10-17T09:00:00Z",
"updated_at": "2024-10-17T09:00:00Z"
}
],
"people": [
{
"id": "123e4567-e89b-12d3-a456-426614174003",
"case_id": "123e4567-e89b-12d3-a456-426614174000",
"name": "John Doe",
"address": "123 St. James Avenue",
"phone_number": "012334 343495",
"postcode": "SW1A 1AA",
"email": "john.doe@example.com",
"created_at": "2024-10-17T09:00:00Z",
"updated_at": "2024-10-17T09:00:00Z"
},
{
"id": "123e4567-e89b-12d3-a456-426614174004",
"case_id": "123e4567-e89b-12d3-a456-426614174000",
"name": "Jane Smith",
"address": "123 St. James Avenue",
"phone_number": "012334 343495",
"postcode": "SW1A 1AA",
"email": "jane.smith@example.com",
"created_at": "2024-10-17T09:00:00Z",
"updated_at": "2024-10-17T09:00:00Z"
}
]
}
Get all case IDs
GET /cases/
Read a case
GET /cases/{case_id}
Modify a case
PATCH /cases/{case_id}
A case can be modified by providing a new case with the following schema.
If an ID of the sub-object is included the object will be updated, if not a new object will be created.
{
"case_type": "CLA",
"notes": [
{
"id": "123e4567-e89b-12d3-a456-426614174003",
"note_type": "Operator",
"content": "Initial client contact made via phone."
},
{
"note_type": "Provider",
"content": "Case documents received and filed."
}
],
"people": [
{
"name": "John Doe",
"address": "123 St. James Avenue",
"phone_number": "012334 343495",
"postcode": "SW1A 1AA",
"email": "john.doe@example.com"
},
{
"name": "Jane Doe",
"address": "124 St. James Avenue",
"phone_number": "012334 343465",
"postcode": "SW1A 1AA",
"email": "jane.smith@example.com"
}
]
}