# Upload File

This endpoint is used for uploading various types of documents including identity verification, financial statements, operation documents, and other customer-related files.

**Endpoint**

`POST/v2/storage`

**Link**

{% embed url="<https://stagep.tst-apidmndelss.com/openapi/v2.html#/operations/Storage_UploadDummy>" %}

### **Request**

#### **Headers**

| Key             | Value                 | Required |
| --------------- | --------------------- | -------- |
| `Authorization` | `123`                 | Yes      |
| `Accept`        | `application/json`    | Yes      |
| `Content-Type`  | `multipart/form-data` | Yes      |

#### **Form Data Parameters**

| Parameter        | Type     | Description                                 | Required | Example        |
| ---------------- | -------- | ------------------------------------------- | -------- | -------------- |
| **`customerId`** | `string` | **Customer ID** to associate the file with. | Yes      | `"cust_12345"` |
| **`attach`**     | `file`   | **File to upload** (document, image, etc.)  | Yes      | `document.pdf` |

***

### **Response (200 OK)**

Returns the uploaded file metadata including storage details and identifiers.

#### **Response Fields**

**File Object**

| Field            | Type      | Description                                             | Example                  |
| ---------------- | --------- | ------------------------------------------------------- | ------------------------ |
| **`partnerId`**  | `string`  | **Partner ID** associated with the file.                | `"partner_abc"`          |
| **`customerId`** | `string`  | **Customer ID** the file is linked to.                  | `"cust_12345"`           |
| **`id`**         | `string`  | **Unique file ID** in the storage system.               | `"file_78901"`           |
| **`name`**       | `string`  | **Original file name**.                                 | `"passport_scan.pdf"`    |
| **`size`**       | `integer` | **File size** in bytes.                                 | `2048576`                |
| **`mime`**       | `string`  | **MIME type** of the file.                              | `"application/pdf"`      |
| **`isLock`**     | `boolean` | **Lock status** (if file is locked from modifications). | `false`                  |
| **`createAt`**   | `string`  | **Creation timestamp**.                                 | `"2024-05-20T10:30:00Z"` |
| **`deletedAt`**  | `string`  | **Deletion timestamp** (if applicable).                 | `"2019-08-24T14:15:22Z"` |

***

### **Examples**

#### **Request**

bash

```
curl -X POST 'https://stagep.tst-apidmndelss.com/v2/storage' \
  -H 'Authorization: 123' \
  -H 'Accept: application/json' \
  -F 'customerId=cust_12345' \
  -F 'attach=@/path/to/document.pdf'
```

#### **Response**

json

```
{
  "file": {
    "partnerId": "partner_abc123",
    "customerId": "cust_12345",
    "id": "file_78901",
    "name": "passport_scan.pdf",
    "size": 2048576,
    "mime": "application/pdf",
    "isLock": false,
    "createAt": "2024-05-20T10:30:00Z",
    "deletedAt": "2019-08-24T14:15:22Z"
  }
}
```

#### **Alternative Request using form-data**

bash

```
curl -X POST 'https://stagep.tst-apidmndelss.com/v2/storage' \
  -H 'Authorization: 123' \
  -H 'Accept: application/json' \
  -F 'customerId=cust_67890' \
  -F 'attach=@/path/to/invoice.jpg'
```

#### **Alternative Response**

json

```
{
  "file": {
    "partnerId": "partner_xyz789",
    "customerId": "cust_67890",
    "id": "file_45678",
    "name": "invoice_q2_2024.jpg",
    "size": 1536000,
    "mime": "image/jpeg",
    "isLock": false,
    "createAt": "2024-05-21T14:20:00Z",
    "deletedAt": "2019-08-24T14:15:22Z"
  }
}
```

***

### **Error Responses**

1. **Invalid Customer ID**:

   json

   ```
   { "error": "Customer not found: cust_99999" }
   ```
2. **File Too Large**:

   json

   ```
   { "error": "File size exceeds maximum limit of 50MB" }
   ```
3. **Unsupported File Type**:

   json

   ```
   { "error": "Unsupported file type: application/zip" }
   ```
4. **Unauthorized**:

   json

   ```
   { "error": "Unauthorized" }
   ```
5. **Missing Required Field**:

   json

   ```
   { "error": "Missing required field: customerId" }
   ```

***

### **Notes**

* **File Size Limits**: Typically supports files up to 50MB (check specific implementation limits)
* **Supported Formats**: Common document and image formats (PDF, JPG, PNG, DOC, DOCX, etc.)
* **Security**: Files are stored securely with access controls based on customer association
* **Metadata**: File metadata is preserved and returned in the response
* **Locking**: Files can be locked to prevent modifications or deletions
* **Deletion**: Soft deletion is supported with `deletedAt` timestamp

**Common Use Cases**:

* Identity verification documents (passports, driver's licenses)
* Financial statements and bank documents
* Operation-related documentation
* Customer onboarding materials
* Compliance and regulatory documents

**File Processing**:

* Files are validated for type and size
* Virus scanning may be performed on upload
* Metadata extraction (for supported formats)
* Secure storage with backup and retention policies


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.delos.financial/files/upload-file.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
