Uploadcare File API

The File API from Uploadcare — 6 operation(s) for file.

OpenAPI Specification

uploadcare-file-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  title: URL API Reference Add-Ons File API
  version: '2022-11-28'
  description: 'Every uploaded file is immediately available on the Uploadcare CDN.

    The CDN includes on-the-fly processing features and can work as a proxy.


    ## API endpoints

    Access files in Uploadcare CDN at `ucarecdn.com` over HTTP/HTTPS like this:

    ```https://ucarecdn.com/:uuid/```


    You can add CDN operations by including directives in the CDN URL:

    ```https://ucarecdn.com/:uuid/-/:operation/:params/:filename```


    * `:uuid` stands for the unique file identifier, UUID, assigned on upload.

    * `/-/` is a mandatory parsing delimiter to divide operations and other path components.

    * `:operation/:params/` is a CDN operation directive with parameters.

    * `:filename` is an optional filename you can add after a trailing slash /.


    You can stack two and more operations like this:

    ```-/:operation/:params/-/:operation/:params/```

    '
  contact:
    name: API support
    email: help@uploadcare.com
  x-logo:
    url: https://ucarecdn.com/12e3af14-392d-416f-8542-f210c2eb6ec4/logourlapi.svg
    backgroundColor: '#fafafa'
    altText: Uploadcare URL API Reference
  x-meta:
    title: URL API Reference — Uploadcare
    description: A reference documentation for the Uploadcare's URL API.
servers:
- url: https://ucarecdn.com
  description: Production server
tags:
- name: File
paths:
  /files/:
    get:
      tags:
      - File
      summary: List of files
      description: Getting a paginated list of files. If you need multiple results pages, use `previous`/`next` from the response to navigate back/forth.
      operationId: filesList
      parameters:
      - $ref: '#/components/parameters/acceptHeader'
      - in: query
        name: removed
        description: '`true` to only include removed files in the response, `false` to include existing files. Defaults to `false`.'
        schema:
          type: boolean
          default: false
          example: true
      - in: query
        name: stored
        description: '`true` to only include files that were stored, `false` to include temporary ones. The default is unset: both stored and not stored files are returned.'
        schema:
          type: boolean
          example: true
      - in: query
        name: limit
        description: A preferred amount of files in a list for a single response. Defaults to 100, while the maximum is 1000.
        schema:
          type: integer
          maximum: 1000
          minimum: 1
          example: 100
          default: 100
      - in: query
        name: ordering
        description: Specifies the way files are sorted in a returned list. `datetime_uploaded` for ascending order, `-datetime_uploaded` for descending order.
        schema:
          type: string
          enum:
          - datetime_uploaded
          - -datetime_uploaded
          default: datetime_uploaded
          example: -datetime_uploaded
      - in: query
        name: from
        description: A starting point for filtering the files. If provided, the value MUST adhere to the ISO 8601 Extended Date/Time Format (`YYYY-MM-DDTHH:MM:SSZ`).
        schema:
          type: string
          example: '2015-09-10T10:00:00Z'
      - in: query
        name: include
        description: 'Include additional fields to the file object, such as: appdata.'
        schema:
          type: string
        example: appdata
      responses:
        '200':
          $ref: '#/components/responses/paginatedFilesResponse'
        '400':
          $ref: '#/components/responses/simpleAuthHTTPForbiddenResponse'
        '401':
          $ref: '#/components/responses/authorizationProblemsResponse'
        '406':
          $ref: '#/components/responses/invalidAcceptHeader'
        '429':
          $ref: '#/components/responses/requestWasThrottledError'
      x-codeSamples:
      - lang: JavaScript
        label: JS
        source: "import {\n  listOfFiles,\n  UploadcareSimpleAuthSchema,\n} from '@uploadcare/rest-client';\n\nconst uploadcareSimpleAuthSchema = new UploadcareSimpleAuthSchema({\n  publicKey: 'YOUR_PUBLIC_KEY',\n  secretKey: 'YOUR_SECRET_KEY',\n});\n\nconst result = await listOfFiles(\n  {},\n  { authSchema: uploadcareSimpleAuthSchema }\n)\n"
      - lang: PHP
        label: PHP
        source: "<?php\n$configuration = Uploadcare\\Configuration::create((string) $_ENV['UPLOADCARE_PUBLIC_KEY'], (string) $_ENV['UPLOADCARE_SECRET_KEY']);\n\n$api = (new Uploadcare\\Api($configuration))->file();\n$list = $api->listFiles();\nforeach ($list->getResults() as $result) {\n    echo \\sprintf('URL: %s', $result->getUrl());\n}\nwhile (($next = $api->nextPage($list)) !== null) {\n    foreach ($next->getResults() as $result) {\n        echo \\sprintf('URL: %s', $result->getUrl());\n    }\n}\n"
      - lang: Python
        label: Python
        source: "from pyuploadcare import Uploadcare\nuploadcare = Uploadcare(public_key='YOUR_PUBLIC_KEY', secret_key='YOUR_SECRET_KEY')\n\nfiles = uploadcare.list_files(stored=True, limit=10)\nfor file in files:\n    print(file.info)\n"
      - lang: Ruby
        label: Ruby
        source: 'require ''uploadcare''

          Uploadcare.config.public_key = ''YOUR_PUBLIC_KEY''

          Uploadcare.config.secret_key = ''YOUR_SECRET_KEY''


          list = Uploadcare::FileList.file_list(stored: true, removed: false, limit: 100)

          list.each { |file| puts file.inspect }

          '
      - lang: Swift
        label: Swift
        source: "import Uploadcare\n\nlet uploadcare = Uploadcare(withPublicKey: \"YOUR_PUBLIC_KEY\", secretKey: \"YOUR_SECRET_KEY\")\n\nlet query = PaginationQuery()\n  .stored(true)\n  .ordering(.dateTimeUploadedDESC)\n  .limit(10)\nvar list = uploadcare.listOfFiles()\n\ntry await list.get(withQuery: query)\nprint(list)\n\n// Next page\nif list.next != nil {\n  try await list.nextPage()\n  print(list)\n}\n\n// Previous page\nif list.previous != nil {\n  try await filesList.previousPage()\n  print(list)\n}\n"
      - lang: Kotlin
        label: Kotlin
        source: "import com.uploadcare.android.library.api.UploadcareClient\n\nval uploadcare = UploadcareClient(publicKey = \"YOUR_PUBLIC_KEY\", secretKey = \"YOUR_SECRET_KEY\")\n\nval filesQueryBuilder = uploadcare.getFiles()\nval files = filesQueryBuilder\n    .stored(true)\n    .ordering(Order.UPLOAD_TIME_DESC)\n    .asList()\nLog.d(\"TAG\", files.toString())\n"
  /files/{uuid}/storage/:
    put:
      summary: Store file
      description: Store a single file by UUID. When file is stored, it is available permanently. If not stored — it will only be available for 24 hours. If the parameter is omitted, it checks the `Auto file storing` setting of your Uploadcare project identified by the `public_key` provided in the `auth-param`.
      tags:
      - File
      operationId: storeFile
      parameters:
      - $ref: '#/components/parameters/acceptHeader'
      - in: path
        name: uuid
        description: File UUID.
        required: true
        schema:
          type: string
          format: uuid
          example: 21975c81-7f57-4c7a-aef9-acfe28779f78
      responses:
        '200':
          description: File stored. File info in JSON.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/file'
        '400':
          $ref: '#/components/responses/simpleAuthHTTPForbiddenResponse'
        '401':
          $ref: '#/components/responses/authorizationProblemsResponse'
        '404':
          $ref: '#/components/responses/fileNotFoundError'
        '406':
          $ref: '#/components/responses/invalidAcceptHeader'
        '429':
          $ref: '#/components/responses/requestWasThrottledError'
      x-codeSamples:
      - lang: JavaScript
        label: JS
        source: "import {\n  storeFile,\n  UploadcareSimpleAuthSchema,\n} from '@uploadcare/rest-client';\n\nconst uploadcareSimpleAuthSchema = new UploadcareSimpleAuthSchema({\n  publicKey: 'YOUR_PUBLIC_KEY',\n  secretKey: 'YOUR_SECRET_KEY',\n});\n\nconst result = await storeFile(\n  {\n    uuid: '1bac376c-aa7e-4356-861b-dd2657b5bfd2',\n  },\n  { authSchema: uploadcareSimpleAuthSchema }\n)\n"
      - lang: PHP
        label: PHP
        source: '<?php

          $configuration = Uploadcare\Configuration::create((string) $_ENV[''UPLOADCARE_PUBLIC_KEY''], (string) $_ENV[''UPLOADCARE_SECRET_KEY'']);


          $api = (new Uploadcare\Api($configuration))->file();

          $result = $api->storeFile(''1bac376c-aa7e-4356-861b-dd2657b5bfd2'');

          echo \sprintf(''File %s is stored at %s'', $result->getUuid(), $result->getDatetimeStored()->format(\DateTimeInterface::ATOM));

          '
      - lang: Python
        label: Python
        source: 'from pyuploadcare import Uploadcare

          uploadcare = Uploadcare(public_key=''YOUR_PUBLIC_KEY'', secret_key=''YOUR_SECRET_KEY'')


          file = uploadcare.file("1bac376c-aa7e-4356-861b-dd2657b5bfd2")

          file.store()

          '
      - lang: Ruby
        label: Ruby
        source: 'require ''uploadcare''

          Uploadcare.config.public_key = ''YOUR_PUBLIC_KEY''

          Uploadcare.config.secret_key = ''YOUR_SECRET_KEY''


          uuid = ''1bac376c-aa7e-4356-861b-dd2657b5bfd2''

          Uploadcare::File.store(uuid)

          '
      - lang: Swift
        label: Swift
        source: 'import Uploadcare


          let uploadcare = Uploadcare(withPublicKey: "YOUR_PUBLIC_KEY", secretKey: "YOUR_SECRET_KEY")


          let file = try await uploadcare.storeFile(withUUID: "1bac376c-aa7e-4356-861b-dd2657b5bfd2")

          print(file)

          '
      - lang: Kotlin
        label: Kotlin
        source: 'import com.uploadcare.android.library.api.UploadcareClient


          val uploadcare = UploadcareClient(publicKey = "YOUR_PUBLIC_KEY", secretKey = "YOUR_SECRET_KEY")


          uploadcare.saveFile("1bac376c-aa7e-4356-861b-dd2657b5bfd2")

          '
    delete:
      summary: Delete file
      tags:
      - File
      description: 'Removes individual files. Returns file info.


        Note: this operation removes the file from storage but doesn''t invalidate CDN cache.

        '
      operationId: deleteFileStorage
      parameters:
      - $ref: '#/components/parameters/acceptHeader'
      - in: path
        name: uuid
        description: File UUID.
        required: true
        schema:
          type: string
          format: uuid
          example: 21975c81-7f57-4c7a-aef9-acfe28779f78
      responses:
        '200':
          description: File deleted. File info in JSON.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/file'
              examples:
                Removed File:
                  $ref: '#/components/examples/file_removed'
        '400':
          $ref: '#/components/responses/simpleAuthHTTPForbiddenResponse'
        '401':
          $ref: '#/components/responses/authorizationProblemsResponse'
        '404':
          $ref: '#/components/responses/fileNotFoundError'
        '406':
          $ref: '#/components/responses/invalidAcceptHeader'
        '429':
          $ref: '#/components/responses/requestWasThrottledError'
      x-codeSamples:
      - lang: JavaScript
        label: JS
        source: "import {\n  deleteFile,\n  UploadcareSimpleAuthSchema,\n} from '@uploadcare/rest-client';\n\nconst uploadcareSimpleAuthSchema = new UploadcareSimpleAuthSchema({\n  publicKey: 'YOUR_PUBLIC_KEY',\n  secretKey: 'YOUR_SECRET_KEY',\n});\n\nconst result = await deleteFile(\n  {\n    uuid: '1bac376c-aa7e-4356-861b-dd2657b5bfd2',\n  },\n  { authSchema: uploadcareSimpleAuthSchema }\n)\n"
      - lang: PHP
        label: PHP
        source: '<?php

          $configuration = Uploadcare\Configuration::create((string) $_ENV[''UPLOADCARE_PUBLIC_KEY''], (string) $_ENV[''UPLOADCARE_SECRET_KEY'']);


          $fileInfo = (new Uploadcare\Api($configuration))->file()->deleteFile(''1bac376c-aa7e-4356-861b-dd2657b5bfd2'');

          echo \sprintf(''File \''%s\'' deleted at \''%s\'''', $fileInfo->getUuid(), $fileInfo->getDatetimeRemoved()->format(\DateTimeInterface::ATOM));

          '
      - lang: Python
        label: Python
        source: 'from pyuploadcare import Uploadcare

          uploadcare = Uploadcare(public_key=''YOUR_PUBLIC_KEY'', secret_key=''YOUR_SECRET_KEY'')


          file = uploadcare.file("1bac376c-aa7e-4356-861b-dd2657b5bfd2")

          file.delete()

          '
      - lang: Ruby
        label: Ruby
        source: 'require ''uploadcare''

          Uploadcare.config.public_key = ''YOUR_PUBLIC_KEY''

          Uploadcare.config.secret_key = ''YOUR_SECRET_KEY''


          puts Uploadcare::File.delete(''1bac376c-aa7e-4356-861b-dd2657b5bfd2'')

          '
      - lang: Swift
        label: Swift
        source: 'import Uploadcare


          let uploadcare = Uploadcare(withPublicKey: "YOUR_PUBLIC_KEY", secretKey: "YOUR_SECRET_KEY")


          let file = try await uploadcare.deleteFile(withUUID: "1bac376c-aa7e-4356-861b-dd2657b5bfd2")

          print(file)

          '
      - lang: Kotlin
        label: Kotlin
        source: 'import com.uploadcare.android.library.api.UploadcareClient


          val uploadcare = UploadcareClient(publicKey = "YOUR_PUBLIC_KEY", secretKey = "YOUR_SECRET_KEY")


          uploadcare.deleteFile(fileId = "1bac376c-aa7e-4356-861b-dd2657b5bfd2")

          '
  /files/{uuid}/:
    get:
      summary: File info
      tags:
      - File
      description: Get file information by its UUID (immutable).
      operationId: fileInfo
      parameters:
      - $ref: '#/components/parameters/acceptHeader'
      - in: path
        name: uuid
        description: File UUID.
        required: true
        schema:
          type: string
          format: uuid
          example: 03ccf9ab-f266-43fb-973d-a6529c55c2ae
      - in: query
        name: include
        description: 'Include additional fields to the file object, such as: appdata.'
        schema:
          type: string
        example: appdata
      responses:
        '200':
          description: File info in JSON.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/file'
              examples:
                Image:
                  $ref: '#/components/examples/file'
                Video:
                  $ref: '#/components/examples/file_video'
        '400':
          $ref: '#/components/responses/simpleAuthHTTPForbiddenResponse'
        '401':
          $ref: '#/components/responses/authorizationProblemsResponse'
        '404':
          $ref: '#/components/responses/fileNotFoundError'
        '406':
          $ref: '#/components/responses/invalidAcceptHeader'
        '429':
          $ref: '#/components/responses/requestWasThrottledError'
      x-codeSamples:
      - lang: JavaScript
        label: JS
        source: "import {\n  fileInfo,\n  UploadcareSimpleAuthSchema,\n} from '@uploadcare/rest-client';\n\nconst uploadcareSimpleAuthSchema = new UploadcareSimpleAuthSchema({\n  publicKey: 'YOUR_PUBLIC_KEY',\n  secretKey: 'YOUR_SECRET_KEY',\n});\n\nconst result = await fileInfo(\n  {\n    uuid: '1bac376c-aa7e-4356-861b-dd2657b5bfd2',\n  },\n  { authSchema: uploadcareSimpleAuthSchema }\n)\n"
      - lang: PHP
        label: PHP
        source: '<?php

          $configuration = Uploadcare\Configuration::create((string) $_ENV[''UPLOADCARE_PUBLIC_KEY''], (string) $_ENV[''UPLOADCARE_SECRET_KEY'']);


          $api = (new Uploadcare\Api($configuration))->file();

          $fileInfo = $api->fileInfo(''1bac376c-aa7e-4356-861b-dd2657b5bfd2'');

          echo \sprintf(''URL: %s, ID: %s, Mime type: %s'', $fileInfo->getUrl(), $fileInfo->getUuid(), $fileInfo->getMimeType());

          '
      - lang: Python
        label: Python
        source: 'from pyuploadcare import Uploadcare

          uploadcare = Uploadcare(public_key=''YOUR_PUBLIC_KEY'', secret_key=''YOUR_SECRET_KEY'')


          file = uploadcare.file("1bac376c-aa7e-4356-861b-dd2657b5bfd2")

          print(file.info)

          '
      - lang: Ruby
        label: Ruby
        source: 'require ''uploadcare''

          Uploadcare.config.public_key = ''YOUR_PUBLIC_KEY''

          Uploadcare.config.secret_key = ''YOUR_SECRET_KEY''


          uuid = ''1bac376c-aa7e-4356-861b-dd2657b5bfd2''

          puts Uploadcare::File.info(uuid).inspect

          '
      - lang: Swift
        label: Swift
        source: 'import Uploadcare


          let uploadcare = Uploadcare(withPublicKey: "YOUR_PUBLIC_KEY", secretKey: "YOUR_SECRET_KEY")


          let fileInfoQuery = FileInfoQuery().include(.appdata)

          let file = try await uploadcare.fileInfo(withUUID: "1bac376c-aa7e-4356-861b-dd2657b5bfd2", withQuery: fileInfoQuery)

          print(file)

          '
      - lang: Kotlin
        label: Kotlin
        source: 'import com.uploadcare.android.library.api.UploadcareClient


          val uploadcare = UploadcareClient(publicKey = "YOUR_PUBLIC_KEY", secretKey = "YOUR_SECRET_KEY")


          val file = uploadcare.getFile(fileId = "1bac376c-aa7e-4356-861b-dd2657b5bfd2")

          Log.d("TAG", file.toString())

          '
  /files/storage/:
    put:
      summary: Batch file storing
      description: Used to store multiple files in one go. Up to 100 files are supported per request. A JSON object holding your File list SHOULD be put into a request body.
      operationId: filesStoring
      tags:
      - File
      parameters:
      - $ref: '#/components/parameters/acceptHeader'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: array
              items:
                type: string
                format: uuid
                description: List of file UUIDs to store.
              example:
              - 21975c81-7f57-4c7a-aef9-acfe28779f78
              - cbaf2d73-5169-4b2b-a543-496cf2813dff
      responses:
        '200':
          $ref: '#/components/responses/filesStorageResponse'
        '400':
          $ref: '#/components/responses/filesStoreUUIDSError'
        '401':
          $ref: '#/components/responses/authorizationProblemsResponse'
        '406':
          $ref: '#/components/responses/invalidAcceptHeader'
        '429':
          $ref: '#/components/responses/requestWasThrottledError'
      x-codeSamples:
      - lang: JavaScript
        label: JS
        source: "import {\n  storeFiles,\n  UploadcareSimpleAuthSchema,\n} from '@uploadcare/rest-client';\n\nconst uploadcareSimpleAuthSchema = new UploadcareSimpleAuthSchema({\n  publicKey: 'YOUR_PUBLIC_KEY',\n  secretKey: 'YOUR_SECRET_KEY',\n});\n\nconst result = await storeFiles(\n  {\n      uuids: [\n          'b7a301d1-1bd0-473d-8d32-708dd55addc0',\n          '1bac376c-aa7e-4356-861b-dd2657b5bfd2',\n        ]\n  },\n  { authSchema: uploadcareSimpleAuthSchema }\n)\n"
      - lang: PHP
        label: PHP
        source: "<?php\n$configuration = Uploadcare\\Configuration::create((string) $_ENV['UPLOADCARE_PUBLIC_KEY'], (string) $_ENV['UPLOADCARE_SECRET_KEY']);\n\nuse Uploadcare\\Interfaces\\File\\FileInfoInterface;\n$api = (new Uploadcare\\Api($configuration))->file();\n$result = $api->batchStoreFile(['b7a301d1-1bd0-473d-8d32-708dd55addc0', '1bac376c-aa7e-4356-861b-dd2657b5bfd2']);\nforeach ($result->getResult() as $result) {\n    if (!$result instanceof FileInfoInterface) {\n        continue;\n    }\n    \\sprintf('Result %s is stored at %s', $result->getUuid(), $result->getDatetimeStored()->format(\\DateTimeInterface::ATOM));\n}\n"
      - lang: Python
        label: Python
        source: "from pyuploadcare import Uploadcare\nuploadcare = Uploadcare(public_key='YOUR_PUBLIC_KEY', secret_key='YOUR_SECRET_KEY')\n\nfiles = [\n    'b7a301d1-1bd0-473d-8d32-708dd55addc0',\n    '1bac376c-aa7e-4356-861b-dd2657b5bfd2'\n]\nuploadcare.store_files(files)\n"
      - lang: Ruby
        label: Ruby
        source: "require 'uploadcare'\nUploadcare.config.public_key = 'YOUR_PUBLIC_KEY'\nUploadcare.config.secret_key = 'YOUR_SECRET_KEY'\n\nuuids = %w[\n  b7a301d1-1bd0-473d-8d32-708dd55addc0\n  1bac376c-aa7e-4356-861b-dd2657b5bfd2\n]\nUploadcare::FileList.batch_store(uuids)\n"
      - lang: Swift
        label: Swift
        source: "import Uploadcare\n\nlet uploadcare = Uploadcare(withPublicKey: \"YOUR_PUBLIC_KEY\", secretKey: \"YOUR_SECRET_KEY\")\n\nlet uuids = [\n  \"b7a301d1-1bd0-473d-8d32-708dd55addc0\",\n  \"1bac376c-aa7e-4356-861b-dd2657b5bfd2\"\n]\nlet response = try await uploadcare.storeFiles(withUUIDs: uuids)\nprint(response)\n"
      - lang: Kotlin
        label: Kotlin
        source: "import com.uploadcare.android.library.api.UploadcareClient\n\nval uploadcare = UploadcareClient(publicKey = \"YOUR_PUBLIC_KEY\", secretKey = \"YOUR_SECRET_KEY\")\n\nval uuids = listOf(\n    \"b7a301d1-1bd0-473d-8d32-708dd55addc0\",\n    \"1bac376c-aa7e-4356-861b-dd2657b5bfd2\"\n)\nuploadcare.saveFiles(uuids)\n"
    delete:
      summary: Batch file delete
      description: 'Used to delete multiple files in one go. Up to 100 files are supported per request. A JSON object holding your File list SHOULD be put into a request body.


        Note: this operation removes files from storage but doesn''t invalidate CDN cache.

        '
      operationId: filesDelete
      tags:
      - File
      parameters:
      - $ref: '#/components/parameters/acceptHeader'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: array
              items:
                type: string
                format: uuid
                description: List of file UUIDs to delete.
              example:
              - 21975c81-7f57-4c7a-aef9-acfe28779f78
              - cbaf2d73-5169-4b2b-a543-496cf2813dff
      responses:
        '200':
          $ref: '#/components/responses/filesStorageResponse'
        '400':
          $ref: '#/components/responses/filesStoreUUIDSError'
        '401':
          $ref: '#/components/responses/authorizationProblemsResponse'
        '406':
          $ref: '#/components/responses/invalidAcceptHeader'
        '429':
          $ref: '#/components/responses/requestWasThrottledError'
      x-codeSamples:
      - lang: JavaScript
        label: JS
        source: "import {\n  deleteFiles,\n  UploadcareSimpleAuthSchema,\n} from '@uploadcare/rest-client';\n\nconst uploadcareSimpleAuthSchema = new UploadcareSimpleAuthSchema({\n  publicKey: 'YOUR_PUBLIC_KEY',\n  secretKey: 'YOUR_SECRET_KEY',\n});\n\nconst result = await deleteFiles(\n  {\n      uuids: [\n          '21975c81-7f57-4c7a-aef9-acfe28779f78',\n          'cbaf2d73-5169-4b2b-a543-496cf2813dff',\n        ]\n  },\n  { authSchema: uploadcareSimpleAuthSchema }\n)\n"
      - lang: PHP
        label: PHP
        source: '<?php

          $configuration = Uploadcare\Configuration::create((string) $_ENV[''UPLOADCARE_PUBLIC_KEY''], (string) $_ENV[''UPLOADCARE_SECRET_KEY'']);


          $api = (new Uploadcare\Api($configuration))->file();

          $fileInfo = $api->fileInfo(''21975c81-7f57-4c7a-aef9-acfe28779f78'');

          $api->deleteFile($fileInfo);

          echo \sprintf(''File \''%s\'' deleted at \''%s\'''', $fileInfo->getUuid(), $fileInfo->getDatetimeRemoved()->format(\DateTimeInterface::ATOM));

          '
      - lang: Python
        label: Python
        source: "from pyuploadcare import Uploadcare\nuploadcare = Uploadcare(public_key='YOUR_PUBLIC_KEY', secret_key='YOUR_SECRET_KEY')\n\nfiles = [\n    '21975c81-7f57-4c7a-aef9-acfe28779f78',\n    'cbaf2d73-5169-4b2b-a543-496cf2813dff'\n    ]\nuploadcare.delete_files(files)\n"
      - lang: Ruby
        label: Ruby
        source: 'require ''uploadcare''

          Uploadcare.config.public_key = ''YOUR_PUBLIC_KEY''

          Uploadcare.config.secret_key = ''YOUR_SECRET_KEY''


          uuids = %w[21975c81-7f57-4c7a-aef9-acfe28779f78 cbaf2d73-5169-4b2b-a543-496cf2813dff]

          puts Uploadcare::FileList.batch_delete(uuids)

          '
      - lang: Swift
        label: Swift
        source: 'import Uploadcare


          let uploadcare = Uploadcare(withPublicKey: "YOUR_PUBLIC_KEY", secretKey: "YOUR_SECRET_KEY")


          let uuids = ["21975c81-7f57-4c7a-aef9-acfe28779f78", "cbaf2d73-5169-4b2b-a543-496cf2813dff"]

          try await uploadcare.deleteFiles(withUUIDs: uuids)

          '
      - lang: Kotlin
        label: Kotlin
        source: 'import com.uploadcare.android.library.api.UploadcareClient


          val uploadcare = UploadcareClient(publicKey = "YOUR_PUBLIC_KEY", secretKey = "YOUR_SECRET_KEY")


          val uuids = listOf("21975c81-7f57-4c7a-aef9-acfe28779f78", "cbaf2d73-5169-4b2b-a543-496cf2813dff")

          uploadcare.deleteFiles(fileIds = uuids)

          '
  /files/local_copy/:
    post:
      summary: Copy file to local storage
      description: 'POST requests are used to copy original files or their modified versions to a default storage.


        Source files MAY either be stored or just uploaded and MUST NOT be deleted.


        Copying of large files is not supported at the moment. If the file CDN URL includes transformation operators, its size MUST NOT exceed 100 MB. If not, the size MUST NOT exceed 5 GB.


        Note: In the immediate 201 response, the `result.size` can be `0` and the `result.mime_type` can be `application/octet-stream`. This indicates the copy has been initiated but is not yet completed.

        Once the copy finishes, fetching the file info (e.g., `GET /files/{uuid}/`) will return the actual size and MIME type.

        '
      tags:
      - File
      operationId: createLocalCopy
      requestBody:
        required: true
        content:
          application/json:
            schema:
              required:
              - source
              type: object
              properties:
                source:
                  description: A CDN URL or just UUID of a file subjected to copy.
                  type: string
                  format: uri
                  example:
                    uuid:
                      value: 85b5644f-e692-4855-9db0-8c5a83096e25
                    cdn:
                      value: http://www.ucarecdn.com/85b5644f-e692-4855-9db0-8c5a83096e25/-/resize/200x/roof.jpg
                store:
                  description: The parameter only applies to the Uploadcare storage and MUST be either true or false.
                  type: string
                  enum:
                  - 'true'
                  - 'false'
                  default: 'false'
                  example: 'true'
                metadata:
                  description: Arbitrary additional metadata.
                  type: object
                  example:
                    subsystem: uploader
            example:
              source: 03ccf9ab-f266-43fb-973d-a6529c55c2ae
              store: 'true'
              metadata:
                subsystem: uploader
                pet: cat
      parameters:
      - $ref: '#/components/parameters/acceptHeader'
      responses:
        '201':
          description: The file was copied successfully. HTTP response contains `result` field with information about the copy.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/localCopyResponse'
        '400':
          $ref: '#/components/responses/fileCopyErrors'
        '401':
          $ref: '#/components/responses/authorizationProblemsResponse'
        '406':
          $ref: '#/components/responses/invalidAcceptHeader'
        '429':
          $ref: '#/components/responses/requestWasThrottledError'
      x-codeSamples:
      - lang: JavaScript
        label: JS
        source: "import {\n  copyFileToLocalStorage,\n  UploadcareSimpleAuthSchema,\n} from '@uploadcare/rest-client';\n\nconst uploadcareSimpleAuthSchema = new UploadcareSimpleAuthSchema({\n  publicKey: 'YOUR_PUBLIC_KEY',\n  secretKey: 'YOUR_SECRET_KEY',\n});\n\nconst result = await copyFileToLocalStorage(\n  {\n    source: '1bac376c-aa7e-4356-861b-dd2657b5bfd2',\n    store: true,\n  },\n  { authSchema: uploadcareSimpleAuthSchema }\n)\n"
      - lang: PHP
        label: PHP
        source: '<?php

          $configuration = Uploadcare\Configuration::create((string) $_ENV[''UPLOADCARE_PUBLIC_KEY''], (string) $_ENV[''UPLOADCARE_SECRET_KEY'']);


          $api = (new Uploadcare\Api($configuration))->file();

          $fileInfo = $api->copyToLocalStorage(''03ccf9ab-f266-43fb-973d-a6529c55c2ae'', true);

          echo \sprintf(''File \''%s\'' copied to local storage'', $fileInfo->getUuid());

          '
      - lang: Python
        label: Python
        source: 'from pyuploadcare import Uploadcare

          uploadcare = Uploadcare(public_key=''YOUR_PUBLIC_KEY'', secret_key=''YOUR_SECRET_KEY'')


          file = uploadcare.file("1bac376c-aa7e-4356-861b-dd2657b5bfd2")

          copied_file = file.create_local_copy(store=True)

          '
      - lang: Ruby
        label: Ruby
        source: 'require ''uploadcare''

          Uploadcare.config.public_key = ''YOUR_PUBLIC_KEY''

          Uploadcare.config.secret_key = ''YOUR_SECRET_KEY''


          source = ''1bac376c-aa7e-4356-861b-dd2657b5bfd2''

          copied_file = Uploadcare::File.local_copy(source, store: true)

          puts copied_file.uuid

          '
      - lang: Swift
        label: Swift
        source: 'import Uploadcare


          let uploadcare = Uploadcare(withPublicKey: "YOUR_PUBLIC_KEY", secretKey: "YOUR_SECRET_KEY")


          let response = try await uploadcare.copyFileToLocalStorage(source: "1bac376c-aa7e-4356-861b-dd2657b5bfd2")

          print(response)

          '
      - lang: Kotlin
        label: Kotlin
        source: 'import com.uploadcare.android.library.api.UploadcareClient


          val uploadcare = UploadcareClient(publicKey = "YOUR_PUBLIC_KEY", secretKey = "YOUR_SECRET_KEY")


          val copyFile = uploadcare.copyFileLocalStorage(source = "1bac376c-aa7e-4356-861b-dd2657b5bfd2")

          Log.d("TAG", copyFile.toString())

          '
  /files/remote_copy/:
    post:
      summary: Copy file to remote storage
      description: 'POST requests are used to copy original files or their modified versions to the S3 bucket.


        Source files MAY either be stored or just uploaded and MUST NOT be deleted.


        Copying of large files is not supported at the moment. File size MUST NOT exceed 5 GB.

        '
      tags:
      - File
      operationId: createRemoteCopy
      requestBody:
        required: true
        content:
          application/json:
            schema:
              required:
              - source
              - target
              type: object
              properties:
                source:
                  description: A CDN URL or just UUID of a file subjected to copy.
                  type: string
                  format: uri
                  example:
                    uuid:
                      value: 85b5644f-e692-4855-9db0-8c5a83096e25
                    cdn:
                      value: http://www.ucarecdn.com/85b5644f-e692-4855-9db0-8c5a83096e25/-/resize/200x/roof.jpg
                target:
                  description: Identifies a custom storage name related to your project. It implies that you are copying a file to a specified custom storage. Keep in mind that you can have multiple storages associated with a single S3 bucket.
                  type: string
                  example: mytarget
                make_public:
                  description: MUST be either `true` or `false`. The `true` value makes copied files available via public links, `false` does the opposite.
                  type: boolean
                  default: true
                  example: true
                pattern:
                  description: 'The parameter is used to specify file names Uploadcare passes to the S3 bucket. If the parameter is omitted, your S3 bucket pattern is used. Use any combination of allowed values.


                    Parameter values:

                    - `${default}` = `${uuid}/${auto_filename}`

                    - `${auto_filename}` = `${filename}${effects}${ext}`

                    - `${effects}` = processing operations put into a CDN URL

                    - `${filename}` = original filename without extension

                    - `${uuid}` = file UUID

                    - `${ext}` = file extension, including period, e.g. .jpg

                    '
                  type: string
                  default: ${default}
                  enum:
                  - 

# --- truncated at 32 KB (74 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/uploadcare/refs/heads/main/openapi/uploadcare-file-api-openapi.yml