# File storage API — Upload Sessions

> Canonical URL: https://developers.apideck.com/apis/file-storage/reference#tag/Upload-Sessions

This document contains every operation on the `Upload Sessions` resource.

---

# Start Upload Session

> **File storage API** · `POST /file-storage/upload-sessions`
> Canonical URL: https://developers.apideck.com/apis/file-storage/reference#tag/Upload-Sessions/operation/uploadSessionsAdd

Start an Upload Session. Upload sessions are used to upload large files, use the [Upload File](#operation/filesUpload) endpoint to upload smaller files (up to 100MB). Note that the base URL is upload.apideck.com instead of unify.apideck.com. For more information on uploads, refer to the [file upload guide](/guides/file-upload).

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `raw` | query | `boolean` | No | Include raw response. Mostly used for debugging purposes |
| `x-apideck-consumer-id` | header | `string` | Yes | ID of the consumer which you want to get or push data from |
| `x-apideck-app-id` | header | `string` | Yes | The ID of your Unify application |
| `x-apideck-service-id` | header | `string` | No | Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. |

### Request Body

_Required._

- `name` `string` **required** — The name of the file. — example: `Documents`
- `parent_folder_id` `string` **required** — The parent folder to create the new file within. This can be an ID or a path depending on the downstream folder. Please see the connector section below to see downstream specific gotchas. — example: `1234`
- `drive_id` `string` — ID of the drive to upload to. — example: `1234`
- `size` `integer` **required** — The size of the file in bytes — example: `1810673`
- `pass_through` `array of object` — The pass_through property allows passing service-specific, custom data or structured modifications in request body when creating or updating resources.
  - `service_id` `string` **required** — Identifier for the service to which this pass_through should be applied.
  - `operation_id` `string` — Optional identifier for a workflow operation to which this pass_through should be applied. This is useful for Unify calls that are making more than one downstream request.
  - `extend_object` `object` — Simple object allowing any properties for direct extension.
  - `extend_paths` `array of object` — Array of objects for structured data modifications via paths.
    - `path` `string` **required** — JSONPath string specifying where to apply the value. — example: `$.nested.property`
    - `value` `any` **required** — The value to set at the specified path, can be any type.

### Responses

#### 201 — UploadSessions

- `status_code` `integer` **required** — HTTP Response Status Code — example: `201`
- `status` `string` **required** — HTTP Response Status — example: `Created`
- `service` `string` **required** — Apideck ID of service provider — example: `dropbox`
- `resource` `string` **required** — Unified API resource name — example: `UploadSessions`
- `operation` `string` **required** — Operation performed — example: `one`
- `data` `object` **required** — A object containing a unique identifier for the resource that was created, updated, or deleted.
  - `id` `string` **required** — The unique identifier of the resource — example: `12345`
- `_raw` `object` — Raw response from the integration when raw=true query param is provided

#### 400 — Bad Request

> Standard error response — see [Error Responses](https://developers.apideck.com/errors)

#### 401 — Unauthorized

> Standard error response — see [Error Responses](https://developers.apideck.com/errors)

#### 402 — Payment Required

> Standard error response — see [Error Responses](https://developers.apideck.com/errors)

#### 404 — The specified resource was not found

> Standard error response — see [Error Responses](https://developers.apideck.com/errors)

#### 422 — Unprocessable

> Standard error response — see [Error Responses](https://developers.apideck.com/errors)

#### default — Unexpected error

> Standard error response — see [Error Responses](https://developers.apideck.com/errors)

---

# Get Upload Session

> **File storage API** · `GET /file-storage/upload-sessions/{id}`
> Canonical URL: https://developers.apideck.com/apis/file-storage/reference#tag/Upload-Sessions/operation/uploadSessionsOne

Get Upload Session. Use the `part_size` to split your file into parts. Upload the parts to the [Upload part of File](#operation/uploadSessionsUpload) endpoint. Note that the base URL is upload.apideck.com instead of unify.apideck.com. For more information on uploads, refer to the [file upload guide](/guides/file-upload).

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | `string` | Yes | ID of the record you are acting upon. |
| `x-apideck-consumer-id` | header | `string` | Yes | ID of the consumer which you want to get or push data from |
| `x-apideck-app-id` | header | `string` | Yes | The ID of your Unify application |
| `x-apideck-service-id` | header | `string` | No | Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. |
| `raw` | query | `boolean` | No | Include raw response. Mostly used for debugging purposes |
| `fields` | query | `string` | No | The 'fields' parameter allows API users to specify the fields they want to include in the API response. If this parameter is not present, the API will return all available fields. If this parameter is present, only the fields specified in the comma-separated string will be included in the response. Nested properties can also be requested by using a dot notation. <br /><br />Example: `fields=name,email,addresses.city`<br /><br />In the example above, the response will only include the fields "name", "email" and "addresses.city". If any other fields are available, they will be excluded. |

### Responses

#### 200 — UploadSessions

- `status_code` `integer` **required** — HTTP Response Status Code — example: `200`
- `status` `string` **required** — HTTP Response Status — example: `OK`
- `service` `string` **required** — Apideck ID of service provider — example: `dropbox`
- `resource` `string` **required** — Unified API resource name — example: `UploadSessions`
- `operation` `string` **required** — Operation performed — example: `one`
- `data` `object` **required**
  - `id` `string` — A unique identifier for an object. — example: `12345`
  - `success` `boolean` — Indicates if the upload session was completed successfully. — example: `true`
  - `part_size` `number` — Size in bytes of each part of the file that you will upload. Uploaded parts need to be this size for the upload to be successful. — example: `1000000`
  - `parallel_upload_supported` `boolean` — Indicates if parts of the file can uploaded in parallel. — example: `true`
  - `uploaded_byte_range` `string` — The range of bytes that was successfully uploaded. — example: `0-42`
  - `expires_at` `string` — format: `date-time` — example: `2022-09-30T07:43:32.000Z`
- `_raw` `object` — Raw response from the integration when raw=true query param is provided

#### 400 — Bad Request

> Standard error response — see [Error Responses](https://developers.apideck.com/errors)

#### 401 — Unauthorized

> Standard error response — see [Error Responses](https://developers.apideck.com/errors)

#### 402 — Payment Required

> Standard error response — see [Error Responses](https://developers.apideck.com/errors)

#### 404 — The specified resource was not found

> Standard error response — see [Error Responses](https://developers.apideck.com/errors)

#### 422 — Unprocessable

> Standard error response — see [Error Responses](https://developers.apideck.com/errors)

#### default — Unexpected error

> Standard error response — see [Error Responses](https://developers.apideck.com/errors)

---

# Upload part of File to Upload Session

> **File storage API** · `PUT /file-storage/upload-sessions/{id}`
> Canonical URL: https://developers.apideck.com/apis/file-storage/reference#tag/Upload-Sessions/operation/uploadSessionsUpload

Upload part of File to Upload Session (max 100MB). Get `part_size` from [Get Upload Session](#operation/uploadSessionsOne) first. Every File part (except the last one) uploaded to this endpoint should have Content-Length equal to `part_size`. Note that the base URL is upload.apideck.com instead of unify.apideck.com. For more information on uploads, refer to the [file upload guide](/guides/file-upload).

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | `string` | Yes | ID of the record you are acting upon. |
| `x-apideck-consumer-id` | header | `string` | Yes | ID of the consumer which you want to get or push data from |
| `x-apideck-app-id` | header | `string` | Yes | The ID of your Unify application |
| `x-apideck-service-id` | header | `string` | No | Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. |
| `part_number` | query | `number` | Yes | Part number of the file part being uploaded. |
| `digest` | header | `string` | No | The RFC3230 message digest of the uploaded part. Only required for the Box connector. More information on the Box API docs [here](https://developer.box.com/reference/put-files-upload-sessions-id/#param-digest) |
| `raw` | query | `boolean` | No | Include raw response. Mostly used for debugging purposes |

### Responses

#### 200 — UploadSessions

- `status_code` `integer` **required** — HTTP Response Status Code — example: `200`
- `status` `string` **required** — HTTP Response Status — example: `OK`
- `service` `string` **required** — Apideck ID of service provider — example: `dropbox`
- `resource` `string` **required** — Unified API resource name — example: `UploadSessions`
- `operation` `string` **required** — Operation performed — example: `one`
- `data` `object` **required** — A object containing a unique identifier for the resource that was created, updated, or deleted.
  - `id` `string` **required** — The unique identifier of the resource — example: `12345`
- `_raw` `object` — Raw response from the integration when raw=true query param is provided

#### 400 — Bad Request

> Standard error response — see [Error Responses](https://developers.apideck.com/errors)

#### 401 — Unauthorized

> Standard error response — see [Error Responses](https://developers.apideck.com/errors)

#### 402 — Payment Required

> Standard error response — see [Error Responses](https://developers.apideck.com/errors)

#### 404 — The specified resource was not found

> Standard error response — see [Error Responses](https://developers.apideck.com/errors)

#### 422 — Unprocessable

> Standard error response — see [Error Responses](https://developers.apideck.com/errors)

#### default — Unexpected error

> Standard error response — see [Error Responses](https://developers.apideck.com/errors)

---

# Abort Upload Session

> **File storage API** · `DELETE /file-storage/upload-sessions/{id}`
> Canonical URL: https://developers.apideck.com/apis/file-storage/reference#tag/Upload-Sessions/operation/uploadSessionsDelete

Abort Upload Session. Note that the base URL is upload.apideck.com instead of unify.apideck.com. For more information on uploads, refer to the [file upload guide](/guides/file-upload).

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | `string` | Yes | ID of the record you are acting upon. |
| `x-apideck-consumer-id` | header | `string` | Yes | ID of the consumer which you want to get or push data from |
| `x-apideck-app-id` | header | `string` | Yes | The ID of your Unify application |
| `x-apideck-service-id` | header | `string` | No | Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. |
| `raw` | query | `boolean` | No | Include raw response. Mostly used for debugging purposes |

### Responses

#### 200 — UploadSessions

- `status_code` `integer` **required** — HTTP Response Status Code — example: `200`
- `status` `string` **required** — HTTP Response Status — example: `OK`
- `service` `string` **required** — Apideck ID of service provider — example: `dropbox`
- `resource` `string` **required** — Unified API resource name — example: `UploadSessions`
- `operation` `string` **required** — Operation performed — example: `one`
- `data` `object` **required** — A object containing a unique identifier for the resource that was created, updated, or deleted.
  - `id` `string` **required** — The unique identifier of the resource — example: `12345`
- `_raw` `object` — Raw response from the integration when raw=true query param is provided

#### 400 — Bad Request

> Standard error response — see [Error Responses](https://developers.apideck.com/errors)

#### 401 — Unauthorized

> Standard error response — see [Error Responses](https://developers.apideck.com/errors)

#### 402 — Payment Required

> Standard error response — see [Error Responses](https://developers.apideck.com/errors)

#### 404 — The specified resource was not found

> Standard error response — see [Error Responses](https://developers.apideck.com/errors)

#### 422 — Unprocessable

> Standard error response — see [Error Responses](https://developers.apideck.com/errors)

#### default — Unexpected error

> Standard error response — see [Error Responses](https://developers.apideck.com/errors)

---

# Finish Upload Session

> **File storage API** · `POST /file-storage/upload-sessions/{id}/finish`
> Canonical URL: https://developers.apideck.com/apis/file-storage/reference#tag/Upload-Sessions/operation/uploadSessionsFinish

Finish Upload Session. Only call this endpoint after all File parts have been uploaded to [Upload part of File](#operation/uploadSessionsUpload). Note that the base URL is upload.apideck.com instead of unify.apideck.com. For more information on uploads, refer to the [file upload guide](/guides/file-upload).

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | `string` | Yes | ID of the record you are acting upon. |
| `raw` | query | `boolean` | No | Include raw response. Mostly used for debugging purposes |
| `x-apideck-consumer-id` | header | `string` | Yes | ID of the consumer which you want to get or push data from |
| `x-apideck-app-id` | header | `string` | Yes | The ID of your Unify application |
| `x-apideck-service-id` | header | `string` | No | Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. |
| `digest` | header | `string` | No | The RFC3230 message digest of the uploaded part. Only required for the Box connector. More information on the Box API docs [here](https://developer.box.com/reference/put-files-upload-sessions-id/#param-digest) |

### Request Body

### Responses

#### 201 — File

- `status_code` `integer` **required** — HTTP Response Status Code — example: `201`
- `status` `string` **required** — HTTP Response Status — example: `Created`
- `service` `string` **required** — Apideck ID of service provider — example: `google-drive`
- `resource` `string` **required** — Unified API resource name — example: `files`
- `operation` `string` **required** — Operation performed — example: `one`
- `data` `object` **required**
  - `id` `string` **required** — A unique identifier for an object. — example: `12345`
  - `downstream_id` `string` — The third-party API ID of original entity — example: `12345`
  - `name` `string` **required** — The name of the file — example: `sample.jpg`
  - `description` `string` — Optional description of the file — example: `A sample image`
  - `type` `string` **required** — The type of resource. Could be file, folder or url — enum: `file`, `folder`, `url` — example: `file`
  - `path` `string` — The full path of the file or folder (includes the file name) — example: `/Documents/sample.jpg`
  - `mime_type` `string` — The MIME type of the file. — example: `image/jpeg`
  - `downloadable` `boolean` — Whether the current user can download this file
  - `size` `integer` — The size of the file in bytes — example: `1810673`
  - `owner` `object`
    - `id` `string` — ID of the owner — example: `12345`
    - `email` `string` — Email of the owner — example: `hello@apideck.com`
    - `name` `string` — Name of the owner — example: `Elon Musk`
  - `parent_folders` `array of object` — The parent folders of the file, starting from the root
    - `id` `string` **required** — A unique identifier for an object. — example: `12345`
    - `name` `string` — The name of the folder — example: `Personal`
  - `parent_folders_complete` `boolean` — Whether the list of parent folders is complete. Some connectors only return the direct parent of a file
  - `permissions` `object` — Permissions the current user has on this file.
    - `download` `boolean` — Whether the current user can download this file.
  - `exportable` `boolean` — Whether the current file is exportable to other file formats. This property is relevant for proprietary file formats such as Google Docs or Dropbox Paper.
  - `export_formats` `array of string` — The available file formats when exporting this file.
  - `custom_mappings` `object` — When custom mappings are configured on the resource, the result is included here.
  - `updated_by` `string` — The user who last updated the object. — example: `12345`
  - `created_by` `string` — The user who created the object. — example: `12345`
  - `updated_at` `string` — The date and time when the object was last updated. — format: `date-time` — example: `2020-09-30T07:43:32.000Z`
  - `created_at` `string` — The date and time when the object was created. — format: `date-time` — example: `2020-09-30T07:43:32.000Z`
- `_raw` `object` — Raw response from the integration when raw=true query param is provided

#### 400 — Bad Request

> Standard error response — see [Error Responses](https://developers.apideck.com/errors)

#### 401 — Unauthorized

> Standard error response — see [Error Responses](https://developers.apideck.com/errors)

#### 402 — Payment Required

> Standard error response — see [Error Responses](https://developers.apideck.com/errors)

#### 404 — The specified resource was not found

> Standard error response — see [Error Responses](https://developers.apideck.com/errors)

#### 422 — Unprocessable

> Standard error response — see [Error Responses](https://developers.apideck.com/errors)

#### default — Unexpected error

> Standard error response — see [Error Responses](https://developers.apideck.com/errors)

---
