---
title: "Upload contact file"
method: POST
path: "/orgs/contacts/{contact_id}/files"
tags: ["Contacts"]
---

# Upload contact file

`POST /orgs/contacts/{contact_id}/files`

## Request

- Base URL: `https://api.useinvent.com`
- URL: `https://api.useinvent.com/orgs/contacts/{contact_id}/files`
- Auth: HTTP bearer

Upload a file to a contact.

## Path parameters

- `contact_id` string, required

## Request body

- CreateFileSchema
  - `file` union: File to be uploaded. It can be a file object, a base64 encoded string, or a file data object containing base64 data, name, and type.
    - string, binary
    - FileDataSchema: Data payload for creating a file
      - `data` string, required: URL, Raw or Base64 encoded file data.
      - `type` string: Mime type of the file, if not provided it will be inferred.
      - `name` string: Name of the file.
      - `encoding` 'base64' | 'raw': Encoding of the file data when it's a direct input, by default base64 is expected.
    - string
  - `file_url` string: URL of the file to be uploaded
  - `allowed_types` string[]: The allowed mime types for the file field (e.g. image/*, application/pdf)

## Response `200`

- ContactFileSchema: A file in a contact collection, with its origin metadata
  - `id` string, required: Unique identifier for the file
  - `file_path` string, required: Path to the file in the storage system
  - `file_filename` string, required: Name of the file
  - `file_size` number, required: Size of the file in bytes
  - `file_mimetype` string, required: MIME type of the file
  - `file_url` string, required: URL to access the file
  - `created_at` string, date-time, nullable, required: Timestamp when the file was created
  - `source` 'direct' | 'comment' | 'chat', required: Where the file came from in the contact: a direct upload, attached to a comment, or sent in a chat
  - `user` object: Staff member who linked the file to the contact. Null when the file came from the contact themselves or was generated by the assistant.
    - `id` string, required
    - `name` string, nullable, required
    - `email` string, email, required
    - `avatar` string, nullable, required
    - `seen_at` string, date-time, nullable, required

---

[API](https://skmtc.dev/useinvent/apis/invent-api.md) · [All operations](https://skmtc.dev/useinvent/apis/invent-api/llms.txt) · [OpenAPI document](https://skmtc.dev/useinvent/apis/invent-api/revisions/98824f3fde82?raw)
