API Service Contracts Demo 1 - COS301-SE-2026/Veritas-Lab GitHub Wiki
Endpoint: POST /api/register
Content-Type: application/json
{
"username": "example_username",
"password": "ExampleP@assword123",
"email": "[email protected]"
}- The username must be unique.
- The password must meet the following requirements:
- Must be at least 8 characters long.
- Must include at least one uppercase character:
A-Z. - Must include at least one digit:
0-9. - Must include at least one lowercase character:
a-z. - Must include at least one special character, for example:
!,@,#.
- The email must be unique and meet the following requirements:
- At least one of the following characters in any order:
0-9,A-Z,a-z,_,.,+, or-. - An
@character follows the requirement above. - At least one of the following characters in any order:
0-9,a-z,A-Z,., or-. - A
.follows the requirement above. - At least two of the following characters in any order:
A-Zora-z.
- At least one of the following characters in any order:
Status Code: 201
{
"status": "success",
"message": "Account created successfully"
}Status Code: 400
{
"status": "error",
"message": "Invalid or missing username"
}-
400- Returned when there are invalid or missing fields in the request body. -
409- Returned when the email or username in the request body is not unique.
Endpoint: POST /api/login
Content-Type: application/json
{
"username": "example_username",
"password": "ExampleP@assword123"
}- The password must meet the following requirements:
- Must be at least 8 characters long.
- Must include at least one uppercase character:
A-Z. - Must include at least one digit:
0-9. - Must include at least one lowercase character:
a-z. - Must include at least one special character, for example:
!,@,#.
Status Code: 200
{
"status": "success",
"token": "Example_token_here"
}Status Code: 401
{
"status": "error",
"message": "Invalid or missing username"
}-
400- Returned when the password or email in the request body does not meet requirements. -
401- Returned when the password is incorrect. -
404- Returned when the user does not exist. -
409- Returned when the email or username in the request body is not unique.
Endpoint: POST /api/createCase
Content-Type: application/jsonAuthorization: Bearer <token_here>
{
"title": "Example title here",
"description": "Example description of the case here."
}- The title cannot be blank or missing.
Status Code: 201
{
"status": "success",
"CaseId": "Example_case_id_here"
}Status Code: 403
{
"status": "error",
"message": "User unauthorized"
}-
400- Returned when the request body does not meet the requirements. -
401- Returned when there is a JWT-related error. -
403- Returned when the user is not authorized to access the endpoint.
Endpoint: POST /api/getCases
Content-Type: application/jsonAuthorization: Bearer <token_here>
{}Status Code: 201
{
"status": "success",
"cases": [
{
"CaseId": "Example id here",
"CaseCreator": "Creator here",
"CaseName": "Suspicious AI-generated claim",
"CaseReviews": null,
"CaseDescription": "Example description",
"CaseClosed": false,
"CaseCreationDate": "2026-05-21T11:30:00"
}
]
}Status Code: 401
{
"status": "error",
"message": "JWT related error here"
}-
401- Returned when there is a JWT-related error.
Endpoint: POST /api/getCases
Content-Type: application/jsonAuthorization: Bearer <token_here>
{
"caseID": "Some case ID"
}- The
caseIDmust not be missing or empty. - The
caseIDmust be a valid UUID.
Status Code: 200
{
"status": "success",
"case": {
"CaseId": "Example id here",
"CaseCreator": "Creator here",
"CaseName": "Suspicious AI-generated claim",
"CaseReviews": null,
"CaseDescription": "Example description",
"CaseClosed": false,
"CaseCreationDate": "2026-05-21T11:30:00"
}
}Status Code: 404
{
"status": "error",
"message": "Case not found"
}-
400- Returned when thecaseIDis missing. -
401- Returned when thecaseIDis not a valid UUID or there is a JWT-related error. -
404- Returned when the case does not exist.
Endpoint: POST /api/evidence
Content-Type: multipart/form-dataAuthorization: Bearer <token_here>
{
"caseID": "Some case ID",
"media": "uploaded file"
}- The
caseIDmust not be missing or empty. - The
caseIDmust be a valid UUID. - The media file must be uploaded.
Status Code: 201
{
"status": "success",
"evidence": {
"MediaId": "Example media UUID here",
"url": "http://localhost:9000/example-bucket/example-file.png",
"Status": "uploaded"
}
}Status Code: 404
{
"status": "error",
"message": "Case not found"
}-
400- Returned when the file extension is unsupported or thecaseIDis invalid. -
401- Returned when there are JWT or UUID errors. -
403- Returned when the user is unauthorized. -
404- Returned when the case does not exist. -
422- Returned by FastAPI when the case media is missing from the form.