---
title: "Update file"
method: PUT
path: "/documents/{id}"
tags: ["Files (Documents)"]
---

# Update file

`PUT /documents/{id}`

## Request

- Base URL: `https://api.pipelinecrm.com/api/v3`
- URL: `https://api.pipelinecrm.com/api/v3/documents/{id}`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer and API key in header `app-key`
  - API key in query parameter `api_key` and API key in query parameter `app_key`

You can update a document's `url` if there was a problem when creating a document. If you update a document's `url`, we will attempt to get the document from that url again, and update the `upload_status` as described in the create documentation above.

### Update a document's tags

To update a document's tags supply an array with the set of tag ids you would like to be applied. Unknown tag ids will be ignored.

```
curl -X PUT -d "document[document_tag_ids][]=13&document[document_tag_ids][]=28" \"https://api.pipelinecrm.com/api/v3/documents/9.json?api_key=XXXXXXXXXXXXXXXXXXXXXXXXX&app_key=XXXXXXXXXXXXXXXXXXXXXXXXX"
```

## Path parameters

- `id` integer, required

## Request body

- object
  - `document` DocumentWritable
    - `updated_at` string: Timestamp when the record was last touched (time zone in user's time zone).
    - `title` string: The filename the document
    - `owner_id` integer: The id of the document owner
    - `person_id` integer, nullable: The id of the person
    - `deal_id` integer, nullable: The id of the deal
    - `company_id` integer, nullable: The id of the company
    - `calendar_entry_id` integer, nullable: The id of the calendar entry (task or event)
    - `primary_association_id` integer: The id of the primary association (Deal, Person, Company, or CalendarEntry). Alternative way to associate documents with entities.
    - `primary_association_type` 'Deal' | 'Person' | 'Company' | 'CalendarTask' | 'CalendarEvent': The type of the primary association. When associating with a calendar entry, use CalendarTask or CalendarEvent.
    - `url` string: The url the document is available at

## Response `200`

Successful Response

- DocumentAll
  - `id` integer: Unique identifier
  - `created_at` string: Timestamp when the record was created (time zone in user's time zone).
  - `size_in_k` integer: The size of the document, in kilobytes
  - `owner` object: A convenience object to get the full name of the document owner
    - `id` integer
    - `full_name` string
  - `person` object, nullable: A convenience object to get the full name of the person the document was uploaded to
    - `id` integer
    - `full_name` string
  - `deal` object, nullable: A convenience object to get the name of the deal the document was uploaded to
    - `id` integer
    - `name` string
  - `company` object, nullable: A convenience object to get the name of the company the document was uploaded to
    - `id` integer
    - `name` string
  - `calendar_entry` object, nullable: A convenience object to get the name and type of the calendar entry (task or event) the document was uploaded to
    - `id` integer
    - `name` string
    - `type` 'CalendarTask' | 'CalendarEvent'
  - `etag` string, nullable: The hash that uniquely identifies the document
  - `upload_status` integer: If you created a document, this will identify the document's upload state. The state will be either 1, 2, or 3, which correspond to "pending", "complete", or "error". If the state is "error", the error message is available in `upload_status_error_message`
  - `upload_status_error_message` string, nullable: If for some reason the document's url returned a non-200 response, the upload_state will be "error", and the upload_status_error_message will be the error returned.
  - `upload_state` string: If you created a document, this will identify the document's upload state. The state will be either "pending", "error", or "complete".
  - `document_tag_ids` integer[]: An array of document tag ids this document is tagged with
  - `document_tags` object[]: The document's tags, with names
    - `id` integer
    - `name` string
  - `public_link` string: A link to get the document
  - `updated_at` string: Timestamp when the record was last touched (time zone in user's time zone).
  - `title` string: The filename the document
  - `owner_id` integer: The id of the document owner
  - `person_id` integer, nullable: The id of the person
  - `deal_id` integer, nullable: The id of the deal
  - `company_id` integer, nullable: The id of the company
  - `calendar_entry_id` integer, nullable: The id of the calendar entry (task or event)
  - `primary_association_id` integer: The id of the primary association (Deal, Person, Company, or CalendarEntry). Alternative way to associate documents with entities.
  - `primary_association_type` 'Deal' | 'Person' | 'Company' | 'CalendarTask' | 'CalendarEvent': The type of the primary association. When associating with a calendar entry, use CalendarTask or CalendarEvent.
  - `url` string: The url the document is available at

## Other responses

- `422`: The request was understood but a value is missing, invalid or too long.

---

[API](https://skmtc.dev/pipelinecrm/apis/pipeline-crm-api.md) · [All operations](https://skmtc.dev/pipelinecrm/apis/pipeline-crm-api/llms.txt) · [OpenAPI document](https://skmtc.dev/pipelinecrm/apis/pipeline-crm-api/revisions/53ebfcc83597?raw)
