Google File Api API

Operations related to File Api

OpenAPI Specification

google-file-api-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Google Books About File Api API
  description: API for retrieving Bookshelf and Volume resources from Google Books
  version: 1.0.0
  contact:
    name: Google Books API
    url: https://developers.google.com/books
servers:
- url: https://www.googleapis.com/books/v1
  description: Google Books API v1
tags:
- name: File Api
  description: Operations related to File Api
paths:
  /files:
    post:
      tags:
      - File Api
      summary: Google Upload File (Resumable)
      description: "Upload a video, PDF, audio, or other media file using resumable upload protocol. Use this for files larger than 20MB, \nvideos longer than approximately 1 minute, or when you want to reuse the file across multiple requests.\n"
      operationId: uploadFile
      parameters:
      - name: X-Goog-Upload-Protocol
        in: header
        required: true
        schema:
          type: string
          enum:
          - resumable
        description: Upload protocol type
      - name: X-Goog-Upload-Command
        in: header
        required: true
        schema:
          type: string
          enum:
          - start
          - upload, finalize
        description: Upload command (start for initiation, "upload, finalize" for data upload)
      - name: X-Goog-Upload-Header-Content-Length
        in: header
        required: false
        schema:
          type: integer
        description: Total size of the file in bytes (required for start command)
      - name: X-Goog-Upload-Header-Content-Type
        in: header
        required: false
        schema:
          type: string
        description: MIME type of the file (required for start command)
      - name: X-Goog-Upload-Offset
        in: header
        required: false
        schema:
          type: integer
        description: Byte offset for upload (required for upload command)
      - name: Content-Length
        in: header
        required: false
        schema:
          type: integer
        description: Size of the current chunk being uploaded
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FilesPostRequest'
          application/octet-stream:
            schema:
              $ref: '#/components/schemas/FilesPostRequest1'
      responses:
        '200':
          description: Upload initiated or completed successfully
          headers:
            x-goog-upload-url:
              description: URL for uploading file data (returned on start command)
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileUploadResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-microcks-operation:
        delay: 100
        dispatcher: FALLBACK
        dispatcherRules: SuccessExample
  /files/{name}:
    get:
      tags:
      - File Api
      summary: Google Get File Metadata
      description: "Retrieve metadata for an uploaded file. Use this to verify the file was successfully \nstored and to check its processing state.\n"
      operationId: getFile
      parameters:
      - name: name
        in: path
        required: true
        description: The resource name of the file (e.g., "files/abc123")
        schema:
          type: string
        example: files/abc123
      responses:
        '200':
          description: File metadata retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileUploadResponse'
        '404':
          description: File not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-microcks-operation:
        delay: 100
        dispatcher: FALLBACK
        dispatcherRules: SuccessExample
components:
  schemas:
    FileUploadResponse:
      type: object
      properties:
        file:
          type: object
          properties:
            name:
              type: string
              description: Resource name of the file
              example: files/abc123
            display_name:
              type: string
              description: Display name of the file
            mime_type:
              type: string
              description: MIME type of the file
              example: video/mp4
            size_bytes:
              type: string
              description: Size of the file in bytes
            create_time:
              type: string
              format: date-time
              description: Creation timestamp
            update_time:
              type: string
              format: date-time
              description: Last update timestamp
            expiration_time:
              type: string
              format: date-time
              description: Expiration timestamp
            sha256_hash:
              type: string
              description: SHA-256 hash of the file
            uri:
              type: string
              description: URI to use in generateContent requests
              example: https://generativelanguage.googleapis.com/v1beta/files/abc123
            state:
              type: string
              enum:
              - STATE_UNSPECIFIED
              - PROCESSING
              - ACTIVE
              - FAILED
              description: Processing state of the file
            error:
              type: object
              description: Error details if state is FAILED
              properties:
                message:
                  type: string
    FilesPostRequestFile:
      description: FilesPostRequestFile schema
      type: object
      properties:
        display_name:
          type: string
          description: Display name for the file
    FilesPostRequest1:
      description: FilesPostRequest1 schema
      type: string
      format: binary
    FilesPostRequest:
      description: FilesPostRequest schema
      type: object
      properties:
        file:
          $ref: '#/components/schemas/FilesPostRequestFile'
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: integer
              description: HTTP status code
            message:
              type: string
              description: Error message
            status:
              type: string
              description: Error status
  securitySchemes:
    OAuth2:
      type: oauth2
      description: OAuth 2.0 authentication for Google Books API
      flows:
        authorizationCode:
          authorizationUrl: https://accounts.google.com/o/oauth2/v2/auth
          tokenUrl: https://oauth2.googleapis.com/token
          scopes:
            https://www.googleapis.com/auth/books: Manage your Google Books library