---
title: "Store file information in DB"
method: POST
path: "/files"
tags: ["Files"]
---

# Store file information in DB

`POST /files`

## Request

- Base URL: `https://api.toriihq.com/v1.0`
- URL: `https://api.toriihq.com/v1.0/files`
- Auth: API key in header `Authorization`

<div><strong>This API is part of a series of API calls you need to make to upload a file to our system.</strong></div>
          <details>
            <summary>
              Click here to see the APIs alongside code examples using cURL
            </summary>
            <ol>
              <li>
                <details>
                  <summary>
                    Look for the 'Get parameters for uploading files' API or use the following code snippet:        
                  </summary>
                  <code class="hljs">curl -H "Authorization: Bearer API_KEY" "https://api.toriihq.com/v1.0/files/url?name={FILE_NAME}&type={CONTENT_TYPE}"</code>
                  <hr />
                  <code className="hljs">curl -H "Authorization: Bearer API_KEY" "https://api.toriihq.com/v1.0/files/url?name=my_file.json&type=text/csv"</code>
                </details>
              </li>
              <li>
                <details>
                  <summary>
                    Use the URL returned to upload the file directly to S3.
                  </summary>
                  <code class="hljs">curl -H "Content-Type: {CONTENT_TYPE}" --data-binary @'PATH/TO/YOUR/FILE' -X PUT "{S3_URL}"</code>
                  <hr />
                <code class="hljs">curl -H "Content-Type: text/csv" --data-binary @'~/Downloads/my_file.json' -X PUT "{S3_URL}"</code>
                </details>
              </li>
              <li>
                <details>
                  <summary>
                    This API. It returns a unique file identifier.
                  </summary>
                  <code class="hljs">curl -d '{"path":"{FILE_PATH}","type":"{FILE_TYPE}"}' -H "Authorization: Bearer API_KEY" -H "Content-Type: application/json" "https://api.toriihq.com/v1.0/files"</code>
                  <hr />
                  <code class="hljs">curl -d '{"path":"1629889604893/my_file.json","type":"expenseReport"}' -H "Authorization: Bearer API_KEY" -H "Content-Type: application/json" "https://api.toriihq.com/v1.0/files"</code>
                </details>
              </li>
            </ol>
          </details>
<p><ul><li>Rate limit: 200 requests per minute</li></ul></p>

## Request body

- StoreFileInformation: Store file information
  - `path` string, required: The path to the file on S3: <Timestamp/Filename>
  - `type` 'attachment' | 'expenseReport' | 'customIntegrationData' | 'plugin' | 'chatAttachment' | 'aiChatFile', required: File type
  - `idApp` integer: The app this file belongs to. Required for an app owner, whose write permission is scoped to that app.
  - `idAppAccount` integer: Connected Slack/Teams account this file arrived from (optional). Not the app the file is about.

## Response `200`

File ID

- FileId: File ID
  - `id` integer: Unique file identifier

---

[API](https://skmtc.dev/toriihq/apis/torii-api-documentation.md) - [All operations](https://skmtc.dev/toriihq/apis/torii-api-documentation/llms.txt) - [OpenAPI document](https://skmtc.dev/toriihq/apis/torii-api-documentation/revisions/15fd1512591b?raw)
