Files

October 21, 2025 ยท View on GitHub

(files)

Overview

Available Operations

list

List files.

Scopes: files:read files:write

Example Usage

from polar_sdk import Polar


with Polar(
    access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:

    res = polar.files.list(organization_id="1dbfc517-0bbf-4301-9ba8-555ca42b9737", page=1, limit=10)

    while res is not None:
        # Handle items

        res = res.next()

Parameters

ParameterTypeRequiredDescription
organization_idOptionalNullable[models.FilesListQueryParamOrganizationIDFilter]:heavy_minus_sign:Filter by organization ID.
idsOptionalNullable[models.FileIDFilter]:heavy_minus_sign:Filter by file ID.
pageOptional[int]:heavy_minus_sign:Page number, defaults to 1.
limitOptional[int]:heavy_minus_sign:Size of a page, defaults to 10. Maximum is 100.
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

models.FilesListResponse

Errors

Error TypeStatus CodeContent Type
models.HTTPValidationError422application/json
models.SDKError4XX, 5XX*/*

create

Create a file.

Scopes: files:write

Example Usage

from polar_sdk import Polar


with Polar(
    access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:

    res = polar.files.create(request={
        "name": "<value>",
        "mime_type": "<value>",
        "size": 612128,
        "upload": {
            "parts": [],
        },
        "service": "downloadable",
    })

    # Handle response
    print(res)

Parameters

ParameterTypeRequiredDescription
requestmodels.FileCreate:heavy_check_mark:The request object to use for the request.
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

models.FileUpload

Errors

Error TypeStatus CodeContent Type
models.HTTPValidationError422application/json
models.SDKError4XX, 5XX*/*

uploaded

Complete a file upload.

Scopes: files:write

Example Usage

from polar_sdk import Polar


with Polar(
    access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:

    res = polar.files.uploaded(id="<value>", file_upload_completed={
        "id": "<id>",
        "path": "/boot",
        "parts": [
            {
                "number": 979613,
                "checksum_etag": "<value>",
                "checksum_sha256_base64": "<value>",
            },
            {
                "number": 979613,
                "checksum_etag": "<value>",
                "checksum_sha256_base64": "<value>",
            },
            {
                "number": 979613,
                "checksum_etag": "<value>",
                "checksum_sha256_base64": "<value>",
            },
        ],
    })

    # Handle response
    print(res)

Parameters

ParameterTypeRequiredDescription
idstr:heavy_check_mark:The file ID.
file_upload_completedmodels.FileUploadCompleted:heavy_check_mark:N/A
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

models.FilesUploadedResponseFilesUploaded

Errors

Error TypeStatus CodeContent Type
models.NotPermitted403application/json
models.ResourceNotFound404application/json
models.HTTPValidationError422application/json
models.SDKError4XX, 5XX*/*

update

Update a file.

Scopes: files:write

Example Usage

from polar_sdk import Polar


with Polar(
    access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:

    res = polar.files.update(id="<value>", file_patch={})

    # Handle response
    print(res)

Parameters

ParameterTypeRequiredDescription
idstr:heavy_check_mark:The file ID.
file_patchmodels.FilePatch:heavy_check_mark:N/A
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

models.FilesUpdateResponseFilesUpdate

Errors

Error TypeStatus CodeContent Type
models.NotPermitted403application/json
models.ResourceNotFound404application/json
models.HTTPValidationError422application/json
models.SDKError4XX, 5XX*/*

delete

Delete a file.

Scopes: files:write

Example Usage

from polar_sdk import Polar


with Polar(
    access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:

    polar.files.delete(id="<value>")

    # Use the SDK ...

Parameters

ParameterTypeRequiredDescription
idstr:heavy_check_mark:N/A
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Errors

Error TypeStatus CodeContent Type
models.NotPermitted403application/json
models.ResourceNotFound404application/json
models.HTTPValidationError422application/json
models.SDKError4XX, 5XX*/*