POST
/
v1
/
indexes
/
{id}
/
files
Header
Path
Body
# Example Request
curl --location --request POST 'https://api.getmetal.io/v1/indexes/{id}/files' \
--header 'Content-Type: application/json' \
--header 'x-metal-api-key: <api-key>' \
--header 'x-metal-client-id: <client-id>' \
--data-raw '{
    "fileName": "example.pdf",
    "fileType": "application/pdf"
}'

{
  "data": {
    "id": "<generated-id>",
    "status": "CREATED",
    "createdAt": "2023-08-29T18:00:00.000Z",
    "fileName": "example.pdf",
    "fileType": "application/pdf",
    "url": "<preSignedUrl>"
  }
}

Two-step process

  • Step 1: POST https://api.getmetal.io/v1/indexes/{id}/files
  • Step 2: PUT to the signed URL

Step 1: Request a Pre-signed URL for the File

Auth Headers

x-metal-api-key
string
required

An API key for your org.

x-metal-client-id
string
required

A Client ID for your org.

x-metal-file-size
number

The size of the file in bytes. Limited to 10MB.

Params

id
string
required

Index ID

Body

fileName
string
required

The name of the file being uploaded.

fileType
string
required

The MIME type of the file being uploaded. Must be one of the following:

  • application/pdf for PDF files
  • text/csv for CSV files
  • application/vnd.openxmlformats-officedocument.wordprocessingml.document for DOCX files

Step 2: Upload the File to the Signed URL

# Example Request
curl --location --request PUT '<preSignedUrl>' \
--header 'Content-Type: application/pdf' \
--upload-file '/path/to/your/example.pdf'