> ## Documentation Index
> Fetch the complete documentation index at: https://botpress-pb-update-api.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# listFiles

> List files for bot



## OpenAPI

````yaml /files-openapi.json get /v1/files
openapi: 3.0.0
info:
  title: Botpress Files API
  description: API for Botpress Files
  version: 1.112.0
servers:
  - url: https://api.botpress.cloud
security:
  - BearerAuth: []
tags:
  - name: documented
paths:
  /v1/files:
    get:
      tags:
        - Endpoints
      description: List files for bot
      operationId: listFiles
      parameters:
        - name: nextToken
          in: query
          description: >-
            Provide the `meta.nextToken` value provided in the last API response
            to retrieve the next page of results
          schema:
            type: string
        - name: pageSize
          in: query
          description: Number of items to return per page (default 20, max 100)
          schema:
            type: integer
        - name: sortField
          in: query
          description: Sort results by this field
          schema:
            type: string
            enum:
              - key
              - size
              - createdAt
              - updatedAt
              - status
        - name: sortDirection
          in: query
          description: Sort results in this direction
          schema:
            type: string
            enum:
              - asc
              - desc
        - name: tags
          in: query
          description: >-
            Filter files by tags. Tags should be passed as a URL-encoded JSON
            object of key-value pairs that must be present in the tags of a
            file. An array of multiple string values for the same key are
            treated as an OR condition. To exclude a value, express it as an
            object with a nested `not` key with the string or string-array
            value(s) to exclude.
          schema: {}
        - name: ids
          in: query
          description: Filter files by IDs.
          schema:
            type: array
            items:
              type: string
            maxItems: 50
        - name: indexed
          in: query
          description: Filter files by indexing state
          schema:
            type: boolean
        - name: x-bot-id
          in: header
          description: Bot id
          required: true
          schema:
            type: string
        - name: x-integration-id
          in: header
          description: Integration id
          required: false
          schema:
            type: string
        - name: x-integration-alias
          in: header
          description: Integration alias
          required: false
          schema:
            type: string
        - name: x-integration-name
          in: header
          description: Integration name
          required: false
          schema:
            type: string
        - name: x-user-id
          in: header
          description: User Id
          required: false
          schema:
            type: string
        - name: x-user-role
          in: header
          description: User Role
          required: false
          schema:
            type: string
      responses:
        '200':
          $ref: '#/components/responses/listFilesResponse'
        default:
          $ref: '#/components/responses/listFilesResponse'
components:
  responses:
    listFilesResponse:
      description: Returns the list of files related to the bot.
      content:
        application/json:
          schema:
            type: object
            properties:
              files:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: string
                      description: File ID
                    botId:
                      type: string
                      description: The ID of the bot the file belongs to
                    key:
                      type: string
                      description: >-
                        Unique key for the file. Must be unique across the bot
                        (and the integration, when applicable).
                    url:
                      type: string
                      description: >-
                        URL to retrieve the file content. This URL will be ready
                        to use once the file is uploaded.


                        If the file has a `public_content` policy, this will
                        contain the permanent public URL to retrieve the file,
                        otherwise this will contain a temporary pre-signed URL
                        to download the file which should be used shortly after
                        retrieving and should not be stored long-term as the URL
                        will expire after a short timeframe.
                    size:
                      type: number
                      description: >-
                        File size in bytes. Non-null if file upload status is
                        "COMPLETE".
                      nullable: true
                    contentType:
                      type: string
                      description: MIME type of the file's content
                    tags:
                      type: object
                      additionalProperties:
                        type: string
                        maxLength: 1000
                      description: The tags of the file as an object of key/value pairs
                    metadata:
                      type: object
                      additionalProperties:
                        nullable: true
                      description: >-
                        Metadata of the file as an object of key/value pairs.
                        The values can be of any type.
                    createdAt:
                      type: string
                      description: File creation timestamp in ISO 8601 format
                    updatedAt:
                      type: string
                      description: File last update timestamp in ISO 8601 format
                    accessPolicies:
                      type: array
                      items:
                        type: string
                        enum:
                          - integrations
                          - public_content
                      description: Access policies configured for the file.
                    index:
                      type: boolean
                      description: >-
                        Whether the file was requested to be indexed for search
                        or not.
                    status:
                      type: string
                      enum:
                        - upload_pending
                        - upload_failed
                        - upload_completed
                        - indexing_pending
                        - indexing_failed
                        - indexing_completed
                      description: >-
                        Status of the file. If the status is `upload_pending`,
                        the file content has not been uploaded yet. The status
                        will be set to `upload_completed` once the file content
                        has been uploaded successfully.


                        If the upload failed for any reason (e.g. exceeding the
                        storage quota or the maximum file size limit) the status
                        will be set to `upload_failed` and the reason for the
                        failure will be available in the `failedStatusReason`
                        field of the file.


                        However, if the file has been uploaded and the `index`
                        attribute was set to `true` on the file, the status will
                        immediately transition to the `indexing_pending` status
                        (the `upload_completed` status step will be skipped).


                        Once the indexing is completed and the file is ready to
                        be used for searching its status will be set to
                        `indexing_completed`. If the indexing failed the status
                        will be set to `indexing_failed` and the reason for the
                        failure will be available in the `failedStatusReason`
                        field.
                    failedStatusReason:
                      type: string
                      description: >-
                        If the file status is `upload_failed` or
                        `indexing_failed` this will contain the reason of the
                        failure.
                    expiresAt:
                      type: string
                      description: File expiry timestamp in ISO 8601 format
                    owner:
                      type: object
                      properties:
                        type:
                          type: string
                          enum:
                            - bot
                            - integration
                            - user
                        id:
                          type: string
                          description: >-
                            This field is present if `type` is "user" or "bot".
                            If `type` is "user", this is the user ID. If `type`
                            is "bot", this is the bot ID.
                        name:
                          type: string
                          description: >-
                            This field is present if the `type` is
                            "integration". If `type` is "integration", this is
                            the integration name.
                        alias:
                          type: string
                          description: >-
                            This field is present if the `type` is
                            "integration". If `type` is "integration", this is
                            the integration instance alias.
                      required:
                        - type
                    indexingStack:
                      type: string
                      enum:
                        - v1
                        - v2
                      description: >-
                        Indicates the indexing stack used to index this file.
                        Present only when file has been successfully indexed. A
                        value of "v2" denotes the latest stack, "v1" denotes the
                        legacy stack.
                  required:
                    - id
                    - botId
                    - key
                    - url
                    - size
                    - contentType
                    - tags
                    - metadata
                    - createdAt
                    - updatedAt
                    - accessPolicies
                    - index
                    - status
                    - owner
              meta:
                type: object
                properties:
                  nextToken:
                    type: string
                    description: >-
                      The token to use to retrieve the next page of results,
                      passed as a query string parameter (value should be
                      URL-encoded) to this API endpoint.
                additionalProperties: false
            required:
              - files
              - meta
            title: listFilesResponse
            additionalProperties: false
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````