Create Attachments
Uploads one or more files to be protected on the DOCONCHAIN blockchain network. Each file can include associated metadata and user information. This endpoint is typically used to register and secure documents for enterprise users.
HTTP Method and URL
POST {{host}}/api/v2/projects/protect?user_type=ENTERPRISE_API
Authentication Requirements
Requires a valid user token. Set the user-token variable in your environment or pass it as an authentication header.
Query Parameters
user_type(string, required): Must be set toENTERPRISE_API.
Request Body
Content-Type: multipart/form-data
-
viewer_access[0](string): Access level for the file (e.g.,Private). -
completed_account_restriction[0](string): Account restriction status (e.g.,yes). -
file[0](file): The first file to upload. -
meta[0](string, JSON): Metadata for the first file (e.g.,{ "student_name": "Sample Test1", "school": "UP" }). -
first_name[0](string): First name of the user for the first file. -
last_name[0](string): Last name of the user for the first file. -
email[0](string): Email of the user for the first file. -
file[1],meta[1],first_name[1],last_name[1],email[1], etc.: Repeat for additional files.
Example Request
POST {{host}}/api/v2/projects/protect?user_type=ENTERPRISE_API
Authorization: Bearer {USER-TOKEN}
Content-Type: multipart/form-data
viewer_access[0]=Private
completed_account_restriction[0]=yes
file[0]=<file1.pdf>
meta[0]="{ \"student_name\": \"Sample Test1\", \"school\": \"UP\" }"
first_name[0]=Sample
last_name[0]=Test1
email[0][email protected]
file[1]=<file2.odt>
meta[1]="{ \"student_name\": \"Sample2 Test2\", \"school\": \"PUP\" }"
first_name[1]=Sample2
last_name[1]=Test2
email[1][email protected]
Example Successful Response
{
"message": "Files protected successfully.",
"data": [
{
"project_uuid": "string",
"project_reference": "string",
"file": {
"type": "string",
"storage": "string",
"reference_number": "string",
"created_by": 123,
"meta": "string",
"project_id": 456,
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:00Z",
"id": 789
}
}
]
}
Error Responses
-
400 Bad Request: Invalid input or missing required fields. -
401 Unauthorized: Authentication failed or missing token. -
500 Internal Server Error: Unexpected server error.
Usage Notes
-
Each file and its associated metadata must use the same index (e.g.,
file[0],meta[0]). -
The endpoint supports uploading multiple files in a single request.
-
Ensure all required fields are included for each file.
| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||
