View Files

This page shows you how to view the files within a Catalog, including their processing status, file UIDs, and the corresponding single source-of-truth stored as a markdown text file.

INFO

Please note that you will have had to upload and process files first before you can view files.

#List Files via API

cURL
Python

export INSTILL_API_TOKEN=********
curl -X GET 'https://api.instill.tech/v1alpha/namespaces/{namespaceId}/catalogs/{catalogId}/files' \
--header "Authorization: Bearer $INSTILL_API_TOKEN" \
--header "Content-Type: application/json"

Note that the {namespaceId} and {catalogId} path parameters must be replaced by the Catalog owner's ID (namespace) and the identifier of the Catalog whose files are to be listed, respectively.

#Optional Query Parameters

You can use the following optional query parameters to customize your request:

  • pageSize (integer): Specifies the number of results per page. The default is 10, and the maximum is 100.
  • pageToken (string): Provides the token for retrieving the next page of results. This is used for pagination, so subsequent requests can continue where the previous one left off.
  • filter.fileUids (array of strings): Filters the results by a list of specific file unique identifiers (UIDs).

Here is an example showing how to make an API request with optional query parameters:

cURL
Python

export INSTILL_API_TOKEN=********
curl -X GET 'https://api.instill.tech/v1alpha/namespaces/{namespaceId}/catalogs/{catalogId}/files?pageSize=10&pageToken=abcd1234&filter.fileUids="file_uid_a"&filter.fileUids="file_uid_b"' \
--header "Authorization: Bearer $INSTILL_API_TOKEN" \
--header "Content-Type: application/json"

#Example Response

A successful response will return a list of files, with their associated Catalogs:


{
"files": [
{
"fileUid": "file123",
"name": "example_file.pdf",
"type": "FILE_TYPE_PDF",
"processStatus": "FILE_PROCESS_STATUS_COMPLETED",
"ownerUid": "owner123",
"kbUid": "kb123",
"createTime": "2024-07-01T12:00:00Z",
"updateTime": "2024-07-01T12:00:00Z",
"size": 1024,
"totalChunks": 10,
"totalTokens": 100
},
{
"fileUid": "file124",
"name": "another_example_file.pdf",
"type": "FILE_TYPE_PDF",
"processStatus": "FILE_PROCESS_STATUS_COMPLETED",
"ownerUid": "owner124",
"kbUid": "kb124",
"createTime": "2024-07-01T12:00:00Z",
"updateTime": "2024-07-01T12:00:00Z",
"size": 2048,
"totalChunks": 20,
"totalTokens": 200
}
],
"totalSize": 2,
"pageSize": 10,
"nextPageToken": "next1234",
"filter": {
"fileUids": [
"file1",
"file2"
]
}
}

#Output Description

  • files: An array of objects where each object represents a file in the Catalog.
    • fileUid (string): The unique identifier of the file.
    • name (string): The name of the file.
    • type (string): The type of the file (e.g., FILE_TYPE_PDF, FILE_TYPE_MARKDOWN, FILE_TYPE_TEXT).
    • processStatus (string): The processing status of the file.
    • ownerUid (string): The UID of the file owner.
    • kbUid (string): The UID of the Catalog the file belongs to.
    • createTime (string): The creation time of the file.
    • updateTime (string): The last update time of the file.
    • size (integer): The size of the file in bytes.
    • totalChunks (integer): The total number of chunks in the file.
    • totalTokens (integer): The total number of tokens in the file.
  • totalSize (integer): The total number of files that match the query.
  • pageSize (integer): The number of files returned in the response.
  • nextPageToken (string): The token for the next page of results. This is used for pagination.
  • filter: The filter object used in the query.
    • fileUids (array of strings): The list of file UIDs used in the filter.

#Get Single Source-of-Truth via API

This API enables you get a processed file's single source-of-truth, stored as markdown text.

cURL
Python

export INSTILL_API_TOKEN=********
curl -X GET 'https://api.instill.tech/v1alpha/namespaces/{namespaceId}/catalogs/{catalogId}/files/{fileUid}/source' \
--header "Authorization: Bearer $INSTILL_API_TOKEN" \
--header "Content-Type: application/json"

Note that the {namespaceId}, {catalogId}, and {fileUid} path parameters must be replaced by the Catalog owner's ID (namespace), the identifier of the Catalog whose file's source is to be retrieved, and the unique identifier (UID) of the processed file whose source is to be retrieved, respectively.

#Example Response

A successful response will return a JSON object containing the details of the single source-of-truth of the file:


{
"sourceFile": {
"originalFileUid": "file123",
"content": "file_content", // single source of truth (markdown text)
"createTime": "2024-07-01T12:00:00Z",
"updateTime": "2024-07-01T12:00:00Z"
}
}

#Output Description

  • sourceFile: An object containing the details of the source file.
    • originalFileUid (string): The unique identifier of the original file.
    • content (string): The base64 encoded content of the source file (single source-of-truth).
    • createTime (string): The creation time of the source file.
    • updateTime (string): The last update time of the source file.

#View Files via 📺 Instill Console

To view files from 📺 Instill Console, follow these steps:

  1. Launch 📺 Instill Console on ☁️ Instill Cloud or via a local 🔮 Instill Core deployment at http://localhost:3000.
  2. Navigate to the Artifacts page using the navigation bar.
  3. Click the Catalog card you wish to view files from.
  4. Select Files in the left panel.

A list of files from your selected Catalog will appear below.

If you click on the file name, the single source of the truth (markdown text) of that file will appear.