# Local File

## Upload local file

POST /v2/team/file/upload-datasource

Upload a local file. Supported file formats include: **.csv**, **.tsv**, **.md**, **.mdx**, **.json**, **.txt**, **.pdf**, **.pptx**, **.ppt**, **.doc**, **.docx**, **.xls**, or **.xlsx**.

You can use this API to upload local files and then use the obtained `file_object_key` to create a data source.

> Body Request Parameters

```yaml
file: ""
user_id: ""

```

### Request Parameters

|Name|Location|Type|Required|Description|Details|
|---|---|---|---|---|---|
|x-pd-external-trace-id|header|string|No||Trace ID set in your local system, supporting up to 128 characters. When an error occurs, you can provide this ID to the MAXIR AI team to assist in troubleshooting.|
|body|body|object|No||none|
|» file|body|string(binary)|Yes||The file to upload. This field is required and should contain the file data. For example, `--form 'file=@"/Users/jiaoqi/Downloads/0f9a7ebd-7a2a-454a-8cd9-96accffa3107.csv"'`.|
|» user_id|body|string|Yes||User ID, which is your unique identity within the organization.|

> Response Example

```json
{
  "code": 0,
  "data": {
    "file_object_key": "/tmp/sdgsagdsgsadgasdg.csv"
  }
}
```

### Response Results

|Status Code|Status Code Meaning|Description|Data Model|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|none|Inline|

### Response Data Structure

Status Code **200**

|Name|Type|Required|Constraint|Description|Details|
|---|---|---|---|---|---|
|» code|integer|true|none||Status code. **0** indicates success. Other values indicate failure. For error troubleshooting, refer to [Error Codes](/docs/maxirai/API/error-codes).|
|» data|object|true|none||Returned data object.|
|»» file_object_key|string|true|none||Object storage path of the file.|

### Response Header

|Status|Header|Type|Format|Description|
|---|---|---|---|---|
|200|x-pd-trace-id|string||MAXIR AI returned Trace ID. When an error occurs, you can provide this ID to the MAXIR AI team to assist in troubleshooting.|