> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Ordering Files and Documents

> Order files inside a document and documents inside a Vantage transaction by passing an integer index when uploading files or creating documents via the API.

To order the files in the document or documents in the transaction, specify the index for each of them during file upload or document creation (at step 4 of the [scenario](/vantage/developer/processing-documents/processing-documents-with-separate-api-calls)). To do so, pass an integer value (a serial number of a file or a document) for the index key while adding a file to the transaction or to the document.

<Tabs>
  <Tab title="For Windows">
    <CodeGroup>
      ```bash US theme={null}
      curl -X POST "https://vantage-us.abbyy.com/api/publicapi/v1/transactions/transaction-id/files/" ^
      -H "accept: */*" ^
      -H "Authorization: Bearer token" ^
      -H "Content-Type: multipart/form-data" ^
      -F "Model={\"files\": [{\"index\": 0}]}" ^
      -F "Files=@testImage.tif;type=image/tiff"
      ```

      ```bash EU theme={null}
      curl -X POST "https://vantage-eu.abbyy.com/api/publicapi/v1/transactions/transaction-id/files/" ^
      -H "accept: */*" ^
      -H "Authorization: Bearer token" ^
      -H "Content-Type: multipart/form-data" ^
      -F "Model={\"files\": [{\"index\": 0}]}" ^
      -F "Files=@testImage.tif;type=image/tiff"
      ```

      ```bash AU theme={null}
      curl -X POST "https://vantage-au.abbyy.com/api/publicapi/v1/transactions/transaction-id/files/" ^
      -H "accept: */*" ^
      -H "Authorization: Bearer token" ^
      -H "Content-Type: multipart/form-data" ^
      -F "Model={\"files\": [{\"index\": 0}]}" ^
      -F "Files=@testImage.tif;type=image/tiff"
      ```
    </CodeGroup>
  </Tab>

  <Tab title="For Linux">
    <CodeGroup>
      ```bash US theme={null}
      curl -X POST 'https://vantage-us.abbyy.com/api/publicapi/v1/transactions/transaction-id/files/' \
      -H 'accept: */*' \
      -H 'Authorization: Bearer token' \
      -H 'Content-Type: multipart/form-data' \
      -F 'Model={"files": [{"index": 0}]}' \
      -F 'Files=@testImage.tif;type=image/tiff'
      ```

      ```bash EU theme={null}
      curl -X POST 'https://vantage-eu.abbyy.com/api/publicapi/v1/transactions/transaction-id/files/' \
      -H 'accept: */*' \
      -H 'Authorization: Bearer token' \
      -H 'Content-Type: multipart/form-data' \
      -F 'Model={"files": [{"index": 0}]}' \
      -F 'Files=@testImage.tif;type=image/tiff'
      ```

      ```bash AU theme={null}
      curl -X POST 'https://vantage-au.abbyy.com/api/publicapi/v1/transactions/transaction-id/files/' \
      -H 'accept: */*' \
      -H 'Authorization: Bearer token' \
      -H 'Content-Type: multipart/form-data' \
      -F 'Model={"files": [{"index": 0}]}' \
      -F 'Files=@testImage.tif;type=image/tiff'
      ```
    </CodeGroup>
  </Tab>
</Tabs>

If you specify no indexes, the files in the transaction or document will be sorted in the order they were uploaded, and the documents in the transaction will be sorted in the order they were created. If the indexes for some files or documents are the same, the order will also be decided by upload or creation time.

All file upload and document creation methods accept indexes for custom ordering:

* `transactions/<transaction-id>/files`
* `transactions/<transaction-id>/documents/<document-id>/sourceFiles`
* `transactions/<transaction-id>/documents`
* `transactions/launch`
