---
title: Create
url: https://www.tines.com/docs/api/cases/files/create-1-0/
updated: 2025-04-01T08:35:03+00:00
description: Attach a file to a case.
---

*[tines.com](https://www.tines.com/llms.txt) › [Docs](https://www.tines.com/llms.txt) › [Tines API](https://www.tines.com/llms.txt) › [Cases](https://www.tines.com/llm/docs/api/cases.md) › [Files](https://www.tines.com/llm/docs/api/cases/files.md)*

# Create

*[View on tines.com](https://www.tines.com/docs/api/cases/files/create-1-0/)*

| ⚠️ Note                                                                     |
| --------------------------------------------------------------------------- |
| This API endpoint has been deprecated, please update to the latest version. |

## Description

Attach a file to a case.

## Request

HTTP Method: **POST**

| Parameter          | Description                                                                                                                                                                                 |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| filename           | The name of the file to be added to the case.                                                                                                                                               |
| file_contents      | Base64 encoded file contents to attach to the case.                                                                                                                                         |
| value              | **Optional** The value of the comment to be added to the case. Supports markdown and mentioning users. To mention a user, use the notation <@user-2435>, replacing '2435' with the user ID. |
| author_email       | **Optional** The email of the user attaching the file to the case.                                                                                                                          |
| team_case_block_id | **Optional** The ID of the file block to attach the file to.                                                                                                                                |

| Path Parameter | Description     |
| -------------- | --------------- |
| case_id        | ID of the case. |

### Sample request

```bash
curl -X POST \
  https://<tenant-domain>/api/v1/cases/<<case_id>>/files \
  -H 'content-type: application/json' \
  -H 'Authorization: Bearer <<CREDENTIAL.tines_api_key>>' \
  -d '{
        "filename": "Name of file",
        "file_contents": "QmFzZTY0IGVuY29kZWQgZlsZSBjb250ZW50cw==",
        "value": "This is a comment alongside a file attachment.",
        "team_case_block_id": 42
      }'
```

## Response

A successful request will return a JSON object describing the action taken on the case - file_attached in this instance.

### Field description

| Parameter | Description                                                                                       |
| --------- | ------------------------------------------------------------------------------------------------- |
| case_id   | The case ID.                                                                                      |
| id        | The ID of the record with the file attached to the case.                                          |
| action    | The action taken on the case - `file_attached` or `file_attached_and_commented` in this instance. |
| value     | The comment added alongside file.                                                                 |
| user      | Details of the user who attached the file - id, first & last name, email & avatar url.            |
| block_id  | **Optional** The ID of the block the file was attached to, if a block ID was specified.           |

### Sample response

<!-- cspell:disable -->

```json
{
  "case_id": 42,
  "id": 7508,
  "action": "FILE_ATTACHED_AND_COMMENTED",
  "value": "This is a comment alongside a file",
  "user": {
    "id": 1,
    "first_name": "Jane",
    "last_name": "Doe",
    "email": "jane@tines.io",
    "avatar_url": "example.com/avatar"
  },
  "block_id": "42"
}
```

<!-- cspell:enable -->
