# Upload Document

This tutorial should help you upload the first Document. Before moving forward, make sure your [**Authentication** ](https://developers.pipelinersales.com/api-docs/overview/authentication)works and you understand the [**Key Concepts**](https://developers.pipelinersales.com/api-docs/core-api-concepts/understanding-the-crm-concept) of the Coevera API, and make sure you know how to use [**API parameters**](https://developers.pipelinersales.com/api-docs/core-api-concepts/api-parameters)

**The Documents** represent the physical file (.docx, .pdf, etc.) that can be linked to records in Coevera

![Documents can be found on almost all Main Coevera Entities](https://3470708952-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFpjbhrh1xo0SPAbAc7Ny%2Fuploads%2F5cbPWA6OhIoFjVsqtT4Z%2FOpportunities%20_%20Pipeliner%20CRM%20-%20Google%20Chrome%202022.png?alt=media\&token=8872e63f-3411-45b8-954c-7b99d4ebc614)

## Tutorial Assignment <a href="#tutorial-assignment" id="tutorial-assignment"></a>

Upload Document to the Account.

### 0. Required fields <a href="#id-0.-required-fields" id="id-0.-required-fields"></a>

<table><thead><tr><th width="251.76811427063683">Required API field Name</th><th>Description</th></tr></thead><tbody><tr><td>filename</td><td>Name of the Document</td></tr><tr><td>content</td><td>The image in base64 encoded string value.</td></tr><tr><td>type</td><td><p>Required. Integer enum values are:</p><p><strong>1</strong> – S3File (recommended - Coevera Storage)  </p><p><strong>2</strong> – S3Image (Coevera Storage), </p><p><strong>3</strong> – GoogleDriveFile, </p><p><strong>4</strong> – OneDriveFile, </p><p><strong>5</strong> – BoxFile, </p><p><strong>6</strong> – DropboxFile, </p><p><strong>7</strong> – SharepointFile, </p><p><strong>8</strong> – ExternalURL.</p></td></tr></tbody></table>

### 1.  Prepare Data

#### Account\_id

As we are going to upload document to a specific account, we need to retrieve its ID

```
{{baseUrl}}/entities/Accounts?include-deleted=false&filter[email1]=info@ziemann-and-sons.de
```

```json
{
            "is_delete_protected": false,
            "id": "0bc376a4-c579-413a-9221-e86e4a134766",
            "is_deleted": false,
            "modified": "2019-02-01 10:01:23.011709+00:00",
            "created": "2019-01-30 11:44:23.586083+00:00",
            "account_type": "https://us-east.pipelinersales.com/api/v100/rest/spaces/nv3_PipelinerDev/entities/AccountTypes/a456236f-6f23-0908-abfd-384aa0f62f9e",
            "customer_type": "https://us-east.pipelinersales.com/api/v100/rest/spaces/nv3_PipelinerDev/entities/Data/04444b3a-c669-03bc-2c49-bcd7f047d41a",
            "industry": "https://us-east.pipelinersales.com/api/v100/rest/spaces/nv3_PipelinerDev/entities/Data/acbda72f-2054-0b71-9d42-cb35aaa37600",
            "owner": "https://us-east.pipelinersales.com/api/v100/rest/spaces/nv3_PipelinerDev/entities/Clients/00000000-0000-0000-0000-000000011a3d",
            "parent_account": null,
            "parent_account_relation_type": null,
            "picture": "https://us-east.pipelinersales.com/api/v100/rest/spaces/nv3_PipelinerDev/entities/CloudObjects/5ddfe953-a569-48e1-86bb-271e6506e7d0",
            "unit": "https://us-east.pipelinersales.com/api/v100/rest/spaces/nv3_PipelinerDev/entities/SalesUnits/ea33e8fb-9a56-4802-a175-2d1f406af7cf",
            "account_class": 5,
            "account_type_id": "a456236f-6f23-0908-abfd-384aa0f62f9e",
            "address": "7 Lillian Plaza",
            "city": "Coronda",
            "comments": "",
            "country": "Argentina",
            "customer_type_id": "04444b3a-c669-03bc-2c49-bcd7f047d41a",
            "email1": "info@ziemann-and-sons.de",
            "email2": "",
            "email3": "",
            "email4": "",
            "email5": "",
            "health_category": null,
            "health_status": null,
            "home_page": "www.ziemannandsons.com",
            "industry_id": "acbda72f-2054-0b71-9d42-cb35aaa37600",
            "name": "Ziemann and Sons",
            "owner_id": "00000000-0000-0000-0000-000000011a3d",
            "parent_account_id": null,
            "parent_account_relation_type_id": null,
            "phone1": "+1 (888) 500-8000",
            "..."
        }
```

### 2.  Upload Document

Uploading document consists of two steps, but we can actually accomplish this in one request:&#x20;

1. Upload document to the Storage
2. Link Document to Account

#### Upload document & linking in one step

In this step, we will upload a document and immediately link that to the Account

{% openapi src="<https://3470708952-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFpjbhrh1xo0SPAbAc7Ny%2Fuploads%2FOlNVdYj1h5GSxQmLHAjz%2Fopenapi%20(1).json?alt=media&token=4be07353-5170-4a95-9100-4f16545d47b0>" path="/entities/CloudObjectRelations" method="post" %}
[openapi (1).json](https://3470708952-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFpjbhrh1xo0SPAbAc7Ny%2Fuploads%2FOlNVdYj1h5GSxQmLHAjz%2Fopenapi%20\(1\).json?alt=media\&token=4be07353-5170-4a95-9100-4f16545d47b0)
{% endopenapi %}

```json
{
    "cloud_object": {
        "filename": "New PDF File.pdf",
        "type": 1,
        "content": "Content in basa64"
    },
    "account_id": "0bc376a4-c579-413a-9221-e86e4a134766"
}
```

{% hint style="info" %}
It is recommended to include the **File Type** in the file name of the document (like \*.pdf, \*.jpg). Then Pipeliner can automatically recognize the format that helps sales people with the opening of documents
{% endhint %}

![](https://3470708952-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFpjbhrh1xo0SPAbAc7Ny%2Fuploads%2FzhELyNoYF2DODJnpTFGT%2FZiemann%20and%20Sons%20_%20Pipeliner%20CRM%20-%20Google%20Chrome%202.png?alt=media\&token=0ffc9462-65f2-4774-a08f-c9b3a927e8c1)

#### Uploading files from external storage

If you wish to upload files that are stored in external storage like (Sharepoint, Google drive) you can do that by changing the `type` attribute. In our case, we are going to Upload a document to Pipeliner that is stored on Google Drive storage.

The list of all `types`

**1** – S3File (recommended - Pipeliner Storage) &#x20;

**2** – S3Image (Pipeliner Storage),&#x20;

**3** – GoogleDriveFile,&#x20;

**4** – OneDriveFile,&#x20;

**5** – BoxFile,&#x20;

**6** – DropboxFile,&#x20;

**7** – SharepointFile,&#x20;

**8** – ExternalURL.

For Uploading external files, you need to specify the `url` instead of `content` attribute

```json
{
    "cloud_object": {
        "filename": "File from google drive",
        "type": 3,
        "url": "https://docs.google.com/spreadsheets/d/1qDQJPID0UHkGywAoopWLYMWHGVDwCo0M2nov-XmzU-Q/edit?usp=sharing"
    },
    "account_id": "0bc376a4-c579-413a-9221-e86e4a134766"
}
```

![](https://3470708952-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFpjbhrh1xo0SPAbAc7Ny%2Fuploads%2FPY3kjwmZkUEyvIeucH4T%2FZiemann%20and%20Sons%20_%20Pipeliner%20CRM%20-%20Google%20Chrome%202.png?alt=media\&token=9ab7eacf-b991-4a1d-8c21-610774a6524f)


---

# 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://developers.pipelinersales.com/api-docs/tutorials-and-articles/upload-document.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.
