> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developer.biposervice.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developer.biposervice.com/_mcp/server.

# File Upload

POST https://server.bipocloud.com/tenant/api2/BIPOAttachment/UploadFile
Content-Type: application/json

Upload a file into BIPO and attach it to an existing record. Send the file as a link (`AWS`, BIPO downloads it, e.g. from an AWS S3 pre-signed URL) or as Base64 content in the request (`BASE64`). See the examples for each.

| Field | Type | Required | Description |
|---|---|---|---|
| AttachmentSource | String | Yes | Where the file is attached. See the table below. |
| RequestID | String | Yes | ID of the record the file belongs to, taken from that record's Export API (see table below). |
| EmployeeCode | String | No | Employee the file belongs to. Maximum 60 characters. |
| Source.Type | String | Yes | `AWS` = BIPO downloads the file from a URL. `BASE64` = file content is sent in the request. |
| Source.Url | String | Conditional | Required when Source.Type is `AWS`. Full http/https link, e.g. an AWS S3 pre-signed URL. The file name is taken from the link. |
| Source.FileName | String | Conditional | Required when Source.Type is `BASE64`. Include the file extension, e.g. `Sample.pdf`. |
| Source.Content | String | Conditional | Required when Source.Type is `BASE64`. File content encoded as Base64. |

| AttachmentSource | Attachment's destination | RequestID from |
|---|---|---|
| EmployeeAttachment | Personnel > Employee > Attachment | AttachmentID |
| ContractEmployeeDetail | Personnel > Employee > Contract > Detail | AttachmentID |
| EmployeeCertificate | Personnel > Employee > Certificate | AttachmentID |
| EmployeeFamily | Personnel > Employee > Family (Vietnam only) | AttachmentID |
| AcknowledgementAttachment | Personnel > Acknowledgement | AttachmentID |
| IdentityConfirmationDocumentAttachment | Personnel > My Number Request (Japan only) | IdentityConfirmationDocument |
| JoinRequestAttachment | Life Cycle > Onboarding > Attachment | AttachmentID |
| JoinRequestCertificate | Life Cycle > Onboarding > Certificate | AttachmentID |
| ResignRequest | Life Cycle > Offboarding Exit Request | AttachmentRequestID |
| ContractRenewal | Life Cycle > Contract Renewal | AttachmentID |
| ContractRequest | Life Cycle > Contract Request | AttachmentID |
| ExitInterviewRecord | Life Cycle > Exit Interview | AttachmentRequestID |
| PersonalDeclaration | Life Cycle > Personal Declaration | AttachmentRequestID |
| ClockingRequest | Attendance > Clocking Request | RequestID |
| OTAuthRequest | Attendance > OT Authorization | RequestID |
| ShiftChangeRequest | Attendance > Shift Change | RequestID |
| Leave | Leave > Leave Record | RequestID |
| LeaveCF | Leave > Leave Carry Forward | RequestID |
| ClaimRecord | Claim > Claim Record | AttachmentID |
| ClaimRequest | Claim > Claim Request | RequestID |

Note: The record must already exist. A RequestID that is not found is rejected and nothing is stored.

Note: File size and file type follow the system's attachment upload settings (maximum 100 MB).

Note: The response returns the new file's `RecordID`.

Note: For `AWS`, the URL must be reachable from the BIPO server and still valid when the API is called.

Reference: https://developer.biposervice.com/bipo-portal/hrms-v-1/system/hrms-v-1-system-file-management/file-upload

## Request

### Body (application/json)

This endpoint expects a string.

- `string`

## Response

### 200

OK

- `ok` (boolean, required)
- `data` (Api2BipoAttachmentUploadFilePostResponsesContentApplicationJsonSchemaData, required)

## Types

### Api2BipoAttachmentUploadFilePostResponsesContentApplicationJsonSchemaData

- `RecordID` (string, required)

## Examples

### File Upload - URL

**Request**

```json
"{\n    // See the AttachmentSource table in the description\n    \"AttachmentSource\": \"Leave\",\n    \"EmployeeCode\": \"00005285\",\n    // ID of the record from its Export API, e.g. \"RequestID\" from Leave Record - LIST\n    \"RequestID\": \"ee6c8987-4619-45e9-b093-17cf62c7dd74\",\n    \"Source\": {\n        // AWS - BIPO downloads the file from \"Url\", e.g. a temporary AWS S3 pre-signed URL\n        \"Type\": \"AWS\",\n        \"Url\": \"https://s3.ap-southeast-1.amazonaws.com/demo.bucket/emp-attach/MCLeave.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=.....&X-Amz-Date=20261113T063918Z&X-Amz-Expires=43200&X-Amz-SignedHeaders=host&X-Amz-Signature=.....\"\n    }\n}"
```

**Response**

```json
{
  "ok": true,
  "data": {
    "RecordID": "a047b4d1-a583-4768-aea0-aca4ca10408b"
  }
}
```

**SDK Code**

```python File Upload - URL
import requests

url = "https://server.bipocloud.com/tenant/api2/BIPOAttachment/UploadFile"

payload = "{
    // See the AttachmentSource table in the description
    \"AttachmentSource\": \"Leave\",
    \"EmployeeCode\": \"00005285\",
    // ID of the record from its Export API, e.g. \"RequestID\" from Leave Record - LIST
    \"RequestID\": \"ee6c8987-4619-45e9-b093-17cf62c7dd74\",
    \"Source\": {
        // AWS - BIPO downloads the file from \"Url\", e.g. a temporary AWS S3 pre-signed URL
        \"Type\": \"AWS\",
        \"Url\": \"https://s3.ap-southeast-1.amazonaws.com/demo.bucket/emp-attach/MCLeave.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=.....&X-Amz-Date=20261113T063918Z&X-Amz-Expires=43200&X-Amz-SignedHeaders=host&X-Amz-Signature=.....\"
    }
}"
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript File Upload - URL
const url = 'https://server.bipocloud.com/tenant/api2/BIPOAttachment/UploadFile';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '"{\n    // See the AttachmentSource table in the description\n    \"AttachmentSource\": \"Leave\",\n    \"EmployeeCode\": \"00005285\",\n    // ID of the record from its Export API, e.g. \"RequestID\" from Leave Record - LIST\n    \"RequestID\": \"ee6c8987-4619-45e9-b093-17cf62c7dd74\",\n    \"Source\": {\n        // AWS - BIPO downloads the file from \"Url\", e.g. a temporary AWS S3 pre-signed URL\n        \"Type\": \"AWS\",\n        \"Url\": \"https://s3.ap-southeast-1.amazonaws.com/demo.bucket/emp-attach/MCLeave.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=.....&X-Amz-Date=20261113T063918Z&X-Amz-Expires=43200&X-Amz-SignedHeaders=host&X-Amz-Signature=.....\"\n    }\n}"'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go File Upload - URL
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://server.bipocloud.com/tenant/api2/BIPOAttachment/UploadFile"

	payload := strings.NewReader("\"{\\n    // See the AttachmentSource table in the description\\n    \\\"AttachmentSource\\\": \\\"Leave\\\",\\n    \\\"EmployeeCode\\\": \\\"00005285\\\",\\n    // ID of the record from its Export API, e.g. \\\"RequestID\\\" from Leave Record - LIST\\n    \\\"RequestID\\\": \\\"ee6c8987-4619-45e9-b093-17cf62c7dd74\\\",\\n    \\\"Source\\\": {\\n        // AWS - BIPO downloads the file from \\\"Url\\\", e.g. a temporary AWS S3 pre-signed URL\\n        \\\"Type\\\": \\\"AWS\\\",\\n        \\\"Url\\\": \\\"https://s3.ap-southeast-1.amazonaws.com/demo.bucket/emp-attach/MCLeave.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=.....&X-Amz-Date=20261113T063918Z&X-Amz-Expires=43200&X-Amz-SignedHeaders=host&X-Amz-Signature=.....\\\"\\n    }\\n}\"")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby File Upload - URL
require 'uri'
require 'net/http'

url = URI("https://server.bipocloud.com/tenant/api2/BIPOAttachment/UploadFile")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "\"{\\n    // See the AttachmentSource table in the description\\n    \\\"AttachmentSource\\\": \\\"Leave\\\",\\n    \\\"EmployeeCode\\\": \\\"00005285\\\",\\n    // ID of the record from its Export API, e.g. \\\"RequestID\\\" from Leave Record - LIST\\n    \\\"RequestID\\\": \\\"ee6c8987-4619-45e9-b093-17cf62c7dd74\\\",\\n    \\\"Source\\\": {\\n        // AWS - BIPO downloads the file from \\\"Url\\\", e.g. a temporary AWS S3 pre-signed URL\\n        \\\"Type\\\": \\\"AWS\\\",\\n        \\\"Url\\\": \\\"https://s3.ap-southeast-1.amazonaws.com/demo.bucket/emp-attach/MCLeave.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=.....&X-Amz-Date=20261113T063918Z&X-Amz-Expires=43200&X-Amz-SignedHeaders=host&X-Amz-Signature=.....\\\"\\n    }\\n}\""

response = http.request(request)
puts response.read_body
```

```java File Upload - URL
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://server.bipocloud.com/tenant/api2/BIPOAttachment/UploadFile")
  .header("Content-Type", "application/json")
  .body("\"{\\n    // See the AttachmentSource table in the description\\n    \\\"AttachmentSource\\\": \\\"Leave\\\",\\n    \\\"EmployeeCode\\\": \\\"00005285\\\",\\n    // ID of the record from its Export API, e.g. \\\"RequestID\\\" from Leave Record - LIST\\n    \\\"RequestID\\\": \\\"ee6c8987-4619-45e9-b093-17cf62c7dd74\\\",\\n    \\\"Source\\\": {\\n        // AWS - BIPO downloads the file from \\\"Url\\\", e.g. a temporary AWS S3 pre-signed URL\\n        \\\"Type\\\": \\\"AWS\\\",\\n        \\\"Url\\\": \\\"https://s3.ap-southeast-1.amazonaws.com/demo.bucket/emp-attach/MCLeave.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=.....&X-Amz-Date=20261113T063918Z&X-Amz-Expires=43200&X-Amz-SignedHeaders=host&X-Amz-Signature=.....\\\"\\n    }\\n}\"")
  .asString();
```

```php File Upload - URL
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://server.bipocloud.com/tenant/api2/BIPOAttachment/UploadFile', [
  'body' => '"{\\n    // See the AttachmentSource table in the description\\n    \\"AttachmentSource\\": \\"Leave\\",\\n    \\"EmployeeCode\\": \\"00005285\\",\\n    // ID of the record from its Export API, e.g. \\"RequestID\\" from Leave Record - LIST\\n    \\"RequestID\\": \\"ee6c8987-4619-45e9-b093-17cf62c7dd74\\",\\n    \\"Source\\": {\\n        // AWS - BIPO downloads the file from \\"Url\\", e.g. a temporary AWS S3 pre-signed URL\\n        \\"Type\\": \\"AWS\\",\\n        \\"Url\\": \\"https://s3.ap-southeast-1.amazonaws.com/demo.bucket/emp-attach/MCLeave.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=.....&X-Amz-Date=20261113T063918Z&X-Amz-Expires=43200&X-Amz-SignedHeaders=host&X-Amz-Signature=.....\\"\\n    }\\n}"',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp File Upload - URL
using RestSharp;

var client = new RestClient("https://server.bipocloud.com/tenant/api2/BIPOAttachment/UploadFile");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "\"{\\n    // See the AttachmentSource table in the description\\n    \\\"AttachmentSource\\\": \\\"Leave\\\",\\n    \\\"EmployeeCode\\\": \\\"00005285\\\",\\n    // ID of the record from its Export API, e.g. \\\"RequestID\\\" from Leave Record - LIST\\n    \\\"RequestID\\\": \\\"ee6c8987-4619-45e9-b093-17cf62c7dd74\\\",\\n    \\\"Source\\\": {\\n        // AWS - BIPO downloads the file from \\\"Url\\\", e.g. a temporary AWS S3 pre-signed URL\\n        \\\"Type\\\": \\\"AWS\\\",\\n        \\\"Url\\\": \\\"https://s3.ap-southeast-1.amazonaws.com/demo.bucket/emp-attach/MCLeave.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=.....&X-Amz-Date=20261113T063918Z&X-Amz-Expires=43200&X-Amz-SignedHeaders=host&X-Amz-Signature=.....\\\"\\n    }\\n}\"", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift File Upload - URL
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = "{
    // See the AttachmentSource table in the description
    \"AttachmentSource\": \"Leave\",
    \"EmployeeCode\": \"00005285\",
    // ID of the record from its Export API, e.g. \"RequestID\" from Leave Record - LIST
    \"RequestID\": \"ee6c8987-4619-45e9-b093-17cf62c7dd74\",
    \"Source\": {
        // AWS - BIPO downloads the file from \"Url\", e.g. a temporary AWS S3 pre-signed URL
        \"Type\": \"AWS\",
        \"Url\": \"https://s3.ap-southeast-1.amazonaws.com/demo.bucket/emp-attach/MCLeave.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=.....&X-Amz-Date=20261113T063918Z&X-Amz-Expires=43200&X-Amz-SignedHeaders=host&X-Amz-Signature=.....\"
    }
}" as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://server.bipocloud.com/tenant/api2/BIPOAttachment/UploadFile")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### File Upload - Base64

**Request**

```json
"{\n    // See the AttachmentSource table in the description\n    \"AttachmentSource\": \"Leave\",\n    \"EmployeeCode\": \"00005285\",\n    // ID of the record from its Export API, e.g. \"RequestID\" from Leave Record - LIST\n    \"RequestID\": \"ee6c8987-4619-45e9-b093-17cf62c7dd74\",\n    \"Source\": {\n        // BASE64 - file content is sent in \"Content\"\n        \"Type\": \"BASE64\",\n        \"FileName\": \"Sample.pdf\",\n        \"Content\": \"JVBERi0xLjQKMSAwIG9iajw8L1R5cGUvQ2F0YWxvZy9QYWdlcyAyIDAgUj4+ZW5kb2JqCjIgMCBvYmo8PC9UeXBlL1BhZ2VzL0tpZHNbMyAwIFJdL0NvdW50IDE+PmVuZG9iagozIDAgb2JqPDwvVHlwZS9QYWdlL1BhcmVudCAyIDAgUi9NZWRpYUJveFswIDAgMjAwIDEwMF0+PmVuZG9iagp0cmFpbGVyPDwvUm9vdCAxIDAgUj4+CiUlRU9GCg==\"\n    }\n}"
```

**Response**

```json
{
  "ok": true,
  "data": {
    "RecordID": "90d29d34-2b2c-4581-b89c-800431cf1dce"
  }
}
```

**SDK Code**

```python File Upload - Base64
import requests

url = "https://server.bipocloud.com/tenant/api2/BIPOAttachment/UploadFile"

payload = "{
    // See the AttachmentSource table in the description
    \"AttachmentSource\": \"Leave\",
    \"EmployeeCode\": \"00005285\",
    // ID of the record from its Export API, e.g. \"RequestID\" from Leave Record - LIST
    \"RequestID\": \"ee6c8987-4619-45e9-b093-17cf62c7dd74\",
    \"Source\": {
        // BASE64 - file content is sent in \"Content\"
        \"Type\": \"BASE64\",
        \"FileName\": \"Sample.pdf\",
        \"Content\": \"JVBERi0xLjQKMSAwIG9iajw8L1R5cGUvQ2F0YWxvZy9QYWdlcyAyIDAgUj4+ZW5kb2JqCjIgMCBvYmo8PC9UeXBlL1BhZ2VzL0tpZHNbMyAwIFJdL0NvdW50IDE+PmVuZG9iagozIDAgb2JqPDwvVHlwZS9QYWdlL1BhcmVudCAyIDAgUi9NZWRpYUJveFswIDAgMjAwIDEwMF0+PmVuZG9iagp0cmFpbGVyPDwvUm9vdCAxIDAgUj4+CiUlRU9GCg==\"
    }
}"
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript File Upload - Base64
const url = 'https://server.bipocloud.com/tenant/api2/BIPOAttachment/UploadFile';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '"{\n    // See the AttachmentSource table in the description\n    \"AttachmentSource\": \"Leave\",\n    \"EmployeeCode\": \"00005285\",\n    // ID of the record from its Export API, e.g. \"RequestID\" from Leave Record - LIST\n    \"RequestID\": \"ee6c8987-4619-45e9-b093-17cf62c7dd74\",\n    \"Source\": {\n        // BASE64 - file content is sent in \"Content\"\n        \"Type\": \"BASE64\",\n        \"FileName\": \"Sample.pdf\",\n        \"Content\": \"JVBERi0xLjQKMSAwIG9iajw8L1R5cGUvQ2F0YWxvZy9QYWdlcyAyIDAgUj4+ZW5kb2JqCjIgMCBvYmo8PC9UeXBlL1BhZ2VzL0tpZHNbMyAwIFJdL0NvdW50IDE+PmVuZG9iagozIDAgb2JqPDwvVHlwZS9QYWdlL1BhcmVudCAyIDAgUi9NZWRpYUJveFswIDAgMjAwIDEwMF0+PmVuZG9iagp0cmFpbGVyPDwvUm9vdCAxIDAgUj4+CiUlRU9GCg==\"\n    }\n}"'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go File Upload - Base64
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://server.bipocloud.com/tenant/api2/BIPOAttachment/UploadFile"

	payload := strings.NewReader("\"{\\n    // See the AttachmentSource table in the description\\n    \\\"AttachmentSource\\\": \\\"Leave\\\",\\n    \\\"EmployeeCode\\\": \\\"00005285\\\",\\n    // ID of the record from its Export API, e.g. \\\"RequestID\\\" from Leave Record - LIST\\n    \\\"RequestID\\\": \\\"ee6c8987-4619-45e9-b093-17cf62c7dd74\\\",\\n    \\\"Source\\\": {\\n        // BASE64 - file content is sent in \\\"Content\\\"\\n        \\\"Type\\\": \\\"BASE64\\\",\\n        \\\"FileName\\\": \\\"Sample.pdf\\\",\\n        \\\"Content\\\": \\\"JVBERi0xLjQKMSAwIG9iajw8L1R5cGUvQ2F0YWxvZy9QYWdlcyAyIDAgUj4+ZW5kb2JqCjIgMCBvYmo8PC9UeXBlL1BhZ2VzL0tpZHNbMyAwIFJdL0NvdW50IDE+PmVuZG9iagozIDAgb2JqPDwvVHlwZS9QYWdlL1BhcmVudCAyIDAgUi9NZWRpYUJveFswIDAgMjAwIDEwMF0+PmVuZG9iagp0cmFpbGVyPDwvUm9vdCAxIDAgUj4+CiUlRU9GCg==\\\"\\n    }\\n}\"")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby File Upload - Base64
require 'uri'
require 'net/http'

url = URI("https://server.bipocloud.com/tenant/api2/BIPOAttachment/UploadFile")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "\"{\\n    // See the AttachmentSource table in the description\\n    \\\"AttachmentSource\\\": \\\"Leave\\\",\\n    \\\"EmployeeCode\\\": \\\"00005285\\\",\\n    // ID of the record from its Export API, e.g. \\\"RequestID\\\" from Leave Record - LIST\\n    \\\"RequestID\\\": \\\"ee6c8987-4619-45e9-b093-17cf62c7dd74\\\",\\n    \\\"Source\\\": {\\n        // BASE64 - file content is sent in \\\"Content\\\"\\n        \\\"Type\\\": \\\"BASE64\\\",\\n        \\\"FileName\\\": \\\"Sample.pdf\\\",\\n        \\\"Content\\\": \\\"JVBERi0xLjQKMSAwIG9iajw8L1R5cGUvQ2F0YWxvZy9QYWdlcyAyIDAgUj4+ZW5kb2JqCjIgMCBvYmo8PC9UeXBlL1BhZ2VzL0tpZHNbMyAwIFJdL0NvdW50IDE+PmVuZG9iagozIDAgb2JqPDwvVHlwZS9QYWdlL1BhcmVudCAyIDAgUi9NZWRpYUJveFswIDAgMjAwIDEwMF0+PmVuZG9iagp0cmFpbGVyPDwvUm9vdCAxIDAgUj4+CiUlRU9GCg==\\\"\\n    }\\n}\""

response = http.request(request)
puts response.read_body
```

```java File Upload - Base64
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://server.bipocloud.com/tenant/api2/BIPOAttachment/UploadFile")
  .header("Content-Type", "application/json")
  .body("\"{\\n    // See the AttachmentSource table in the description\\n    \\\"AttachmentSource\\\": \\\"Leave\\\",\\n    \\\"EmployeeCode\\\": \\\"00005285\\\",\\n    // ID of the record from its Export API, e.g. \\\"RequestID\\\" from Leave Record - LIST\\n    \\\"RequestID\\\": \\\"ee6c8987-4619-45e9-b093-17cf62c7dd74\\\",\\n    \\\"Source\\\": {\\n        // BASE64 - file content is sent in \\\"Content\\\"\\n        \\\"Type\\\": \\\"BASE64\\\",\\n        \\\"FileName\\\": \\\"Sample.pdf\\\",\\n        \\\"Content\\\": \\\"JVBERi0xLjQKMSAwIG9iajw8L1R5cGUvQ2F0YWxvZy9QYWdlcyAyIDAgUj4+ZW5kb2JqCjIgMCBvYmo8PC9UeXBlL1BhZ2VzL0tpZHNbMyAwIFJdL0NvdW50IDE+PmVuZG9iagozIDAgb2JqPDwvVHlwZS9QYWdlL1BhcmVudCAyIDAgUi9NZWRpYUJveFswIDAgMjAwIDEwMF0+PmVuZG9iagp0cmFpbGVyPDwvUm9vdCAxIDAgUj4+CiUlRU9GCg==\\\"\\n    }\\n}\"")
  .asString();
```

```php File Upload - Base64
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://server.bipocloud.com/tenant/api2/BIPOAttachment/UploadFile', [
  'body' => '"{\\n    // See the AttachmentSource table in the description\\n    \\"AttachmentSource\\": \\"Leave\\",\\n    \\"EmployeeCode\\": \\"00005285\\",\\n    // ID of the record from its Export API, e.g. \\"RequestID\\" from Leave Record - LIST\\n    \\"RequestID\\": \\"ee6c8987-4619-45e9-b093-17cf62c7dd74\\",\\n    \\"Source\\": {\\n        // BASE64 - file content is sent in \\"Content\\"\\n        \\"Type\\": \\"BASE64\\",\\n        \\"FileName\\": \\"Sample.pdf\\",\\n        \\"Content\\": \\"JVBERi0xLjQKMSAwIG9iajw8L1R5cGUvQ2F0YWxvZy9QYWdlcyAyIDAgUj4+ZW5kb2JqCjIgMCBvYmo8PC9UeXBlL1BhZ2VzL0tpZHNbMyAwIFJdL0NvdW50IDE+PmVuZG9iagozIDAgb2JqPDwvVHlwZS9QYWdlL1BhcmVudCAyIDAgUi9NZWRpYUJveFswIDAgMjAwIDEwMF0+PmVuZG9iagp0cmFpbGVyPDwvUm9vdCAxIDAgUj4+CiUlRU9GCg==\\"\\n    }\\n}"',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp File Upload - Base64
using RestSharp;

var client = new RestClient("https://server.bipocloud.com/tenant/api2/BIPOAttachment/UploadFile");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "\"{\\n    // See the AttachmentSource table in the description\\n    \\\"AttachmentSource\\\": \\\"Leave\\\",\\n    \\\"EmployeeCode\\\": \\\"00005285\\\",\\n    // ID of the record from its Export API, e.g. \\\"RequestID\\\" from Leave Record - LIST\\n    \\\"RequestID\\\": \\\"ee6c8987-4619-45e9-b093-17cf62c7dd74\\\",\\n    \\\"Source\\\": {\\n        // BASE64 - file content is sent in \\\"Content\\\"\\n        \\\"Type\\\": \\\"BASE64\\\",\\n        \\\"FileName\\\": \\\"Sample.pdf\\\",\\n        \\\"Content\\\": \\\"JVBERi0xLjQKMSAwIG9iajw8L1R5cGUvQ2F0YWxvZy9QYWdlcyAyIDAgUj4+ZW5kb2JqCjIgMCBvYmo8PC9UeXBlL1BhZ2VzL0tpZHNbMyAwIFJdL0NvdW50IDE+PmVuZG9iagozIDAgb2JqPDwvVHlwZS9QYWdlL1BhcmVudCAyIDAgUi9NZWRpYUJveFswIDAgMjAwIDEwMF0+PmVuZG9iagp0cmFpbGVyPDwvUm9vdCAxIDAgUj4+CiUlRU9GCg==\\\"\\n    }\\n}\"", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift File Upload - Base64
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = "{
    // See the AttachmentSource table in the description
    \"AttachmentSource\": \"Leave\",
    \"EmployeeCode\": \"00005285\",
    // ID of the record from its Export API, e.g. \"RequestID\" from Leave Record - LIST
    \"RequestID\": \"ee6c8987-4619-45e9-b093-17cf62c7dd74\",
    \"Source\": {
        // BASE64 - file content is sent in \"Content\"
        \"Type\": \"BASE64\",
        \"FileName\": \"Sample.pdf\",
        \"Content\": \"JVBERi0xLjQKMSAwIG9iajw8L1R5cGUvQ2F0YWxvZy9QYWdlcyAyIDAgUj4+ZW5kb2JqCjIgMCBvYmo8PC9UeXBlL1BhZ2VzL0tpZHNbMyAwIFJdL0NvdW50IDE+PmVuZG9iagozIDAgb2JqPDwvVHlwZS9QYWdlL1BhcmVudCAyIDAgUi9NZWRpYUJveFswIDAgMjAwIDEwMF0+PmVuZG9iagp0cmFpbGVyPDwvUm9vdCAxIDAgUj4+CiUlRU9GCg==\"
    }
}" as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://server.bipocloud.com/tenant/api2/BIPOAttachment/UploadFile")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### File Upload - invalid AttachmentSource

**Request**

```json
"{\n    // See the AttachmentSource table in the description\n    \"AttachmentSource\": \"Leave\",\n    \"EmployeeCode\": \"00005285\",\n    // ID of the record from its Export API, e.g. \"RequestID\" from Leave Record - LIST\n    \"RequestID\": \"ee6c8987-4619-45e9-b093-17cf62c7dd74\",\n    \"Source\": {\n        // AWS - BIPO downloads the file from \"Url\", e.g. a temporary AWS S3 pre-signed URL\n        \"Type\": \"AWS\",\n        \"Url\": \"https://s3.ap-southeast-1.amazonaws.com/demo.bucket/emp-attach/MCLeave.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=.....&X-Amz-Date=20261113T063918Z&X-Amz-Expires=43200&X-Amz-SignedHeaders=host&X-Amz-Signature=.....\"\n    }\n}"
```

**Response**

```json
{
  "ok": false,
  "data": {
    "RecordID": "string"
  },
  "msg": "Invalid entry of Attachment Source."
}
```

**SDK Code**

```python File Upload - invalid AttachmentSource
import requests

url = "https://server.bipocloud.com/tenant/api2/BIPOAttachment/UploadFile"

payload = "{
    // See the AttachmentSource table in the description
    \"AttachmentSource\": \"Leave\",
    \"EmployeeCode\": \"00005285\",
    // ID of the record from its Export API, e.g. \"RequestID\" from Leave Record - LIST
    \"RequestID\": \"ee6c8987-4619-45e9-b093-17cf62c7dd74\",
    \"Source\": {
        // AWS - BIPO downloads the file from \"Url\", e.g. a temporary AWS S3 pre-signed URL
        \"Type\": \"AWS\",
        \"Url\": \"https://s3.ap-southeast-1.amazonaws.com/demo.bucket/emp-attach/MCLeave.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=.....&X-Amz-Date=20261113T063918Z&X-Amz-Expires=43200&X-Amz-SignedHeaders=host&X-Amz-Signature=.....\"
    }
}"
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript File Upload - invalid AttachmentSource
const url = 'https://server.bipocloud.com/tenant/api2/BIPOAttachment/UploadFile';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '"{\n    // See the AttachmentSource table in the description\n    \"AttachmentSource\": \"Leave\",\n    \"EmployeeCode\": \"00005285\",\n    // ID of the record from its Export API, e.g. \"RequestID\" from Leave Record - LIST\n    \"RequestID\": \"ee6c8987-4619-45e9-b093-17cf62c7dd74\",\n    \"Source\": {\n        // AWS - BIPO downloads the file from \"Url\", e.g. a temporary AWS S3 pre-signed URL\n        \"Type\": \"AWS\",\n        \"Url\": \"https://s3.ap-southeast-1.amazonaws.com/demo.bucket/emp-attach/MCLeave.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=.....&X-Amz-Date=20261113T063918Z&X-Amz-Expires=43200&X-Amz-SignedHeaders=host&X-Amz-Signature=.....\"\n    }\n}"'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go File Upload - invalid AttachmentSource
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://server.bipocloud.com/tenant/api2/BIPOAttachment/UploadFile"

	payload := strings.NewReader("\"{\\n    // See the AttachmentSource table in the description\\n    \\\"AttachmentSource\\\": \\\"Leave\\\",\\n    \\\"EmployeeCode\\\": \\\"00005285\\\",\\n    // ID of the record from its Export API, e.g. \\\"RequestID\\\" from Leave Record - LIST\\n    \\\"RequestID\\\": \\\"ee6c8987-4619-45e9-b093-17cf62c7dd74\\\",\\n    \\\"Source\\\": {\\n        // AWS - BIPO downloads the file from \\\"Url\\\", e.g. a temporary AWS S3 pre-signed URL\\n        \\\"Type\\\": \\\"AWS\\\",\\n        \\\"Url\\\": \\\"https://s3.ap-southeast-1.amazonaws.com/demo.bucket/emp-attach/MCLeave.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=.....&X-Amz-Date=20261113T063918Z&X-Amz-Expires=43200&X-Amz-SignedHeaders=host&X-Amz-Signature=.....\\\"\\n    }\\n}\"")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby File Upload - invalid AttachmentSource
require 'uri'
require 'net/http'

url = URI("https://server.bipocloud.com/tenant/api2/BIPOAttachment/UploadFile")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "\"{\\n    // See the AttachmentSource table in the description\\n    \\\"AttachmentSource\\\": \\\"Leave\\\",\\n    \\\"EmployeeCode\\\": \\\"00005285\\\",\\n    // ID of the record from its Export API, e.g. \\\"RequestID\\\" from Leave Record - LIST\\n    \\\"RequestID\\\": \\\"ee6c8987-4619-45e9-b093-17cf62c7dd74\\\",\\n    \\\"Source\\\": {\\n        // AWS - BIPO downloads the file from \\\"Url\\\", e.g. a temporary AWS S3 pre-signed URL\\n        \\\"Type\\\": \\\"AWS\\\",\\n        \\\"Url\\\": \\\"https://s3.ap-southeast-1.amazonaws.com/demo.bucket/emp-attach/MCLeave.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=.....&X-Amz-Date=20261113T063918Z&X-Amz-Expires=43200&X-Amz-SignedHeaders=host&X-Amz-Signature=.....\\\"\\n    }\\n}\""

response = http.request(request)
puts response.read_body
```

```java File Upload - invalid AttachmentSource
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://server.bipocloud.com/tenant/api2/BIPOAttachment/UploadFile")
  .header("Content-Type", "application/json")
  .body("\"{\\n    // See the AttachmentSource table in the description\\n    \\\"AttachmentSource\\\": \\\"Leave\\\",\\n    \\\"EmployeeCode\\\": \\\"00005285\\\",\\n    // ID of the record from its Export API, e.g. \\\"RequestID\\\" from Leave Record - LIST\\n    \\\"RequestID\\\": \\\"ee6c8987-4619-45e9-b093-17cf62c7dd74\\\",\\n    \\\"Source\\\": {\\n        // AWS - BIPO downloads the file from \\\"Url\\\", e.g. a temporary AWS S3 pre-signed URL\\n        \\\"Type\\\": \\\"AWS\\\",\\n        \\\"Url\\\": \\\"https://s3.ap-southeast-1.amazonaws.com/demo.bucket/emp-attach/MCLeave.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=.....&X-Amz-Date=20261113T063918Z&X-Amz-Expires=43200&X-Amz-SignedHeaders=host&X-Amz-Signature=.....\\\"\\n    }\\n}\"")
  .asString();
```

```php File Upload - invalid AttachmentSource
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://server.bipocloud.com/tenant/api2/BIPOAttachment/UploadFile', [
  'body' => '"{\\n    // See the AttachmentSource table in the description\\n    \\"AttachmentSource\\": \\"Leave\\",\\n    \\"EmployeeCode\\": \\"00005285\\",\\n    // ID of the record from its Export API, e.g. \\"RequestID\\" from Leave Record - LIST\\n    \\"RequestID\\": \\"ee6c8987-4619-45e9-b093-17cf62c7dd74\\",\\n    \\"Source\\": {\\n        // AWS - BIPO downloads the file from \\"Url\\", e.g. a temporary AWS S3 pre-signed URL\\n        \\"Type\\": \\"AWS\\",\\n        \\"Url\\": \\"https://s3.ap-southeast-1.amazonaws.com/demo.bucket/emp-attach/MCLeave.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=.....&X-Amz-Date=20261113T063918Z&X-Amz-Expires=43200&X-Amz-SignedHeaders=host&X-Amz-Signature=.....\\"\\n    }\\n}"',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp File Upload - invalid AttachmentSource
using RestSharp;

var client = new RestClient("https://server.bipocloud.com/tenant/api2/BIPOAttachment/UploadFile");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "\"{\\n    // See the AttachmentSource table in the description\\n    \\\"AttachmentSource\\\": \\\"Leave\\\",\\n    \\\"EmployeeCode\\\": \\\"00005285\\\",\\n    // ID of the record from its Export API, e.g. \\\"RequestID\\\" from Leave Record - LIST\\n    \\\"RequestID\\\": \\\"ee6c8987-4619-45e9-b093-17cf62c7dd74\\\",\\n    \\\"Source\\\": {\\n        // AWS - BIPO downloads the file from \\\"Url\\\", e.g. a temporary AWS S3 pre-signed URL\\n        \\\"Type\\\": \\\"AWS\\\",\\n        \\\"Url\\\": \\\"https://s3.ap-southeast-1.amazonaws.com/demo.bucket/emp-attach/MCLeave.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=.....&X-Amz-Date=20261113T063918Z&X-Amz-Expires=43200&X-Amz-SignedHeaders=host&X-Amz-Signature=.....\\\"\\n    }\\n}\"", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift File Upload - invalid AttachmentSource
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = "{
    // See the AttachmentSource table in the description
    \"AttachmentSource\": \"Leave\",
    \"EmployeeCode\": \"00005285\",
    // ID of the record from its Export API, e.g. \"RequestID\" from Leave Record - LIST
    \"RequestID\": \"ee6c8987-4619-45e9-b093-17cf62c7dd74\",
    \"Source\": {
        // AWS - BIPO downloads the file from \"Url\", e.g. a temporary AWS S3 pre-signed URL
        \"Type\": \"AWS\",
        \"Url\": \"https://s3.ap-southeast-1.amazonaws.com/demo.bucket/emp-attach/MCLeave.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=.....&X-Amz-Date=20261113T063918Z&X-Amz-Expires=43200&X-Amz-SignedHeaders=host&X-Amz-Signature=.....\"
    }
}" as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://server.bipocloud.com/tenant/api2/BIPOAttachment/UploadFile")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```