QwenCloudBRASIL
Tradução de apoio para consulta. Código e identificadores técnicos preservados. Consultar referência original ↗

Lista arquivos

OpenAPI

openapi: 3.1.0
info:
  title: QwenCloud File API
  description: Upload and manage files for document analysis or batch processing.
  version: 1.0.0
servers:
  - url: https://maas.qwencloudapi.com/compatible-mode/v1
    description: Singapore
security:
  - BearerAuth: []
paths:
  /files:
    get:
      operationId: listFiles
      summary: List files
      description: List all files in your account (uploaded files and batch results), with filtering by purpose, creation time, and pagination.
      parameters:
        - name: after
          in: query
          required: false
          description: Pagination cursor. Set to the `file_id` of the last item on the current page to retrieve the next page.
          schema:
            type: string
            example: file-batch-xxx
        - name: limit
          in: query
          required: false
          description: "Number of files per page. Range: 1-2,000. Default: 2,000."
          schema:
            type: integer
            minimum: 1
            maximum: 2000
            default: 2000
        - name: purpose
          in: query
          required: false
          description: "Filter files by purpose. Valid values: `file-extract`, `batch`."
          schema:
            type: string
            enum:
              - file-extract
              - batch
        - name: create_before
          in: query
          required: false
          description: "Returns files created before this time. Accepts formats: `yyyyMMddHHmmss`, `yyyy-MM-dd HH:mm:ss`, `yyyy-MM-dd`, `yyyyMMdd`."
          schema:
            type: string
            example: "20250306123000"
        - name: create_after
          in: query
          required: false
          description: "Returns files created after this time. Accepts formats: `yyyyMMddHHmmss`, `yyyy-MM-dd HH:mm:ss`, `yyyy-MM-dd`, `yyyyMMdd`."
          schema:
            type: string
            example: "20250306123000"
      responses:
        "200":
          description: File list retrieved successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListFilesResponse"
              example:
                data:
                  - id: file-batch-xxx
                    bytes: 27
                    created_at: 1722480543
                    filename: test.txt
                    object: file
                    purpose: batch
                    status: processed
                    status_details: null
                  - id: file-batch-yyy
                    bytes: 431986
                    created_at: 1718089390
                    filename: test.pdf
                    object: file
                    purpose: batch
                    status: processed
                    status_details: null
                object: list
                has_more: false
      x-codeSamples:
        - lang: python
          label: Python
          source: |-
            import os
            from openai import OpenAI

            client = OpenAI(
              api_key=os.getenv("DASHSCOPE_API_KEY"),
              base_url="https://maas.qwencloudapi.com/compatible-mode/v1",
            )

            file_list = client.files.list(
              after="file-batch-xxx",
              limit=20
            )
            print(file_list.model_dump_json())
        - lang: javascript
          label: Node.js
          source: |-
            import OpenAI from "openai";

            const client = new OpenAI({
              apiKey: process.env.DASHSCOPE_API_KEY,
              baseURL: "https://maas.qwencloudapi.com/compatible-mode/v1",
            });

            const fileList = await client.files.list({
              after: "file-batch-xxx",
              limit: 20,
            });
            console.log(fileList);
        - lang: curl
          label: cURL
          source: |-
            curl "https://maas.qwencloudapi.com/compatible-mode/v1/files" \
              -H "Authorization: Bearer $DASHSCOPE_API_KEY"
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: QwenCloud API Key. Create one in the [console](https://home.qwencloud.com/api-keys).
  schemas:
    UploadFileRequest:
      type: object
      required:
        - file
        - purpose
      properties:
        file:
          type: string
          format: binary
          description: The file to upload.
        purpose:
          type: string
          enum:
            - file-extract
            - batch
          description: |-
            The intended use of the file.

            - `file-extract`: Document analysis. Max 150 MB. Supported formats: TXT, DOCX, PDF, XLSX, EPUB, MOBI, MD, CSV, JSON, BMP, PNG, JPG/JPEG, GIF, scanned PDFs.
            - `batch`: Batch processing. Max 500 MB. JSONL format ([Batch file requirements](/developer-guides/text-generation/batch#input-file-format)).
    FileObject:
      type: object
      properties:
        id:
          type: string
          description: Unique file identifier.
          example: file-fe-xxx
        bytes:
          type: integer
          description: File size in bytes.
          example: 2055
        created_at:
          type: integer
          description: Unix timestamp (seconds) when the file was created.
          example: 1729065448
        filename:
          type: string
          description: The uploaded filename.
          example: test.txt
        object:
          type: string
          enum:
            - file
          description: Always `file`.
        purpose:
          type: string
          description: "File purpose. Valid values: `batch`, `file-extract`, `batch_output`."
          example: file-extract
        status:
          type: string
          description: Current file status.
          example: processed
        status_details:
          type: string
          nullable: true
          description: Additional status details. `null` when no details available.
    ListFilesResponse:
      type: object
      properties:
        object:
          type: string
          enum:
            - list
          description: Always `list`.
        data:
          type: array
          description: List of file objects.
          items:
            $ref: "#/components/schemas/FileObject"
        has_more:
          type: boolean
          description: Whether a next page exists.
    DeleteFileResponse:
      type: object
      properties:
        object:
          type: string
          enum:
            - file
          description: Always `file`.
        deleted:
          type: boolean
          description: Whether the deletion succeeded.
        id:
          type: string
          description: The deleted file's ID.
          example: file-batch-xxx