Create declaration with attachment
const url = 'https://localhost:10001/api/v1/projects/example/policies/example/controls/example/declarations/with-file';const form = new FormData();form.append('declaration', 'example');
const options = {method: 'POST', headers: {Authorization: '<Authorization>'}};
options.body = form;
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://localhost:10001/api/v1/projects/example/policies/example/controls/example/declarations/with-file \ --header 'Authorization: <Authorization>' \ --header 'Content-Type: multipart/form-data' \ --form declaration=exampleCreate a declaration on a control with file attachment(s) and return the declaration with stored attachments
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”Project ID, UUID (urn:uuid optional), or slug:my-project
Applied policy ID, slug:my-policy, or urn:cid:bafy…
Applied policy control ID, code:AC-1, or urn:cid:bafy…
FormData Parameters
Section titled “FormData Parameters ”Declaration JSON string
Attachment files
Attachment description
Whether the file is public
Retention policy
Responses
Section titled “ Responses ”Created declaration with attachments
A newly created declaration together with the attachments uploaded alongside it
object
A file stored against a declaration or review, with its CID and retention window
object
Verifiable actor; uploadedBy is the label
A submitted claim that a control has been implemented, optionally attested by a CID
object
Taken from the path on create
Derived from the uploaded bytes; not stored
Assigned by the integrity service
Hashed into the CID; not stored
object
Upload via the with-file endpoint
A file stored against a declaration or review, with its CID and retention window
object
Verifiable actor; uploadedBy is the label
True for indicator-generated only
Needs submit_controls_for_review
Defaults to the caller identity
Verifiable actor; submittedBy is the label
Example generated
{ "attachments": [ { "cid": "example", "contentType": "example", "declarationId": 1, "description": "example", "fileName": "example", "id": 1, "isPublic": true, "retentionExpires": "2026-04-15T12:00:00Z", "reviewId": 1, "sizeBytes": 1, "storagePath": "example", "uploadedAt": "2026-04-15T12:00:00Z", "uploadedBy": "example" } ], "declaration": { "extra": { "additionalProperty": "example" }, "isReadyForReview": true, "statement": "example", "subjectLine": "example", "submittedBy": "example" }}Bad request - Invalid IDs or declaration data
Error body returned by the governance endpoints; the message is human-readable and not a stable identifier
object
Example
{ "error": "Invalid request body"}Unauthorized - Authentication required
Error body returned by the governance endpoints; the message is human-readable and not a stable identifier
object
Example
{ "error": "Invalid request body"}Forbidden - Insufficient permissions to create declarations
Error body returned by the governance endpoints; the message is human-readable and not a stable identifier
object
Example
{ "error": "Invalid request body"}Not found - Unknown or mismatched identifier
Error body returned by the governance endpoints; the message is human-readable and not a stable identifier
object
Example
{ "error": "Invalid request body"}Internal server error
Error body returned by the governance endpoints; the message is human-readable and not a stable identifier
object
Example
{ "error": "Invalid request body"}