Added

Added POST endpoint for creating application documents

Added POST /api/v1/applications/:application_id/documents for creating documents (ApplicationMiscFile) via the API.

Endpoint

POST /api/v1/applications/:application_id/documents

Create a document attached to an application. The request body uses JSON:API format with a data object containing type and attributes. Attribute keys may be dasherized (e.g. file-data) or underscored (e.g. file_data).

Path Parameters:

  • application_id – Binti Application ID

Request Body (under data.attributes):

Required:

  • file-data – Base64-encoded file contents (must be valid base64)
  • file-filename – Filename for the uploaded file (e.g. checklist.pdf)

Response: 201 Created with the created document in the same schema as the GET index/show endpoints.

Errors:

  • 404 Not Found – Application not found or not in scope
  • 422 Unprocessable Entity – Request body or file is invalid. Error details are returned in the JSON:API errors format. Cases:
    • Schema validation: Missing required attributes (file-data or file-filename). The error source.pointer and detail identify the offending attributes.
    • Invalid base64: file-data is not valid base64-encoded data. Error is attributed to file-data.
    • File validation (after schema): Virus detected, or other file validation failure.