Files

Store file information in DB

<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>
post/files

Request

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

Request body

pathstring required

The path to the file on S3: <Timestamp/Filename>

type'attachment' | 'expenseReport' | 'customIntegrationData' | 'plugin' | 'chatAttachment' | 'aiChatFile' required

File type

idAppinteger

The app this file belongs to. Required for an app owner, whose write permission is scoped to that app.

idAppAccountinteger

Connected Slack/Teams account this file arrived from (optional). Not the app the file is about.

Example request

{
  "path": "1612686123657/test_file.xlsx",
  "type": "expenseReport",
  "idApp": 1000,
  "idAppAccount": 1000
}

Response

File ID

idinteger

Unique file identifier

Example response

{
  "id": 1000
}

Changes

No recorded changes to this operation across all 1 revision of this API.