Skip to content

Relate the uploaded file to a specific entity

POST https://api.copper.com/developer_api/v1/{{entity_type}}/{{entity_id}}/files

This API endpoint is step 3 of 3 to upload a file and attach it to an existing entity.

The endpoint relates the uploaded file to a specific entity, where {{entity_type}} and {{entity_id}} are replaced with the following:

Field Type Details Default
entity_type* string Must be one of: "leads", "people", "opportunities", "companies", "projects"
entity_id* number ID of the entity record

* indicates a required field

Request body

1
2
3
4
{
  "file_name": "cat.jpeg",
  "key": "temp_uploads/f0317718-9b56-4d28-bda4-985af6b75f56/b0c5afe5-3d87-495d-ae58-760fcafbadec"
}

Example Requests

Relate the uploaded file to a specific entity

1
2
3
4
5
6
7
8
9
curl --location --request POST "https://api.copper.com/developer_api/v1/{{entity_type}}/{{entity_id}}/files" \
  --header "X-PW-AccessToken: YOUR_TOKEN_HERE" \
  --header "X-PW-Application: developer_api" \
  --header "X-PW-UserEmail: YOUR_EMAIL_HERE" \
  --header "Content-Type: application/json" \
  --data "{
    \"file_name\": \"cat.jpeg\",
    \"key\": \"temp_uploads/f0317718-9b56-4d28-bda4-985af6b75f56/b0c5afe5-3d87-495d-ae58-760fcafbadec\"
}"
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
{
  "id": 469753997,
  "is_deleted": false,
  "file_name": "cat.jpeg",
  "file_size": 38,
  "content_type": "binary/octet-stream",
  "creator_id": 342164,
  "date_created": 1560203853,
  "date_modified": 1560203854
}