---
title: "Create temporary file from a remote URL"
method: POST
path: "/api/v1/temp/byUrl"
tags: ["Temporary Files"]
---

# Create temporary file from a remote URL

`POST /api/v1/temp/byUrl`

Downloads a file from the specified remote URL and stores it as a temporary resource. The temporary file can then be referenced when creating content. The URL must pass validation to prevent SSRF attacks. Anonymous access can be allowed via the TEMP_RESOURCE_ALLOW_ANONYMOUS configuration property.

**Use this endpoint to supply files for binary and image fields** (`ImmutableBinaryField`, `ImmutableImageField`) when a file is already accessible by URL. Send `{"remoteUrl": "https://example.com/image.jpg"}` and pass `tempFiles[0].id` (e.g. `"temp_5311313004"`) as the field value in the workflow fire endpoint. See `PUT /api/v1/workflow/actions/default/fire/{systemAction}` for the full pattern.

## Request body

- RemoteUrlForm
  - `remoteUrl` string
  - `fileName` string
  - `accessKey` string
  - `urlTimeoutSeconds` integer
  - `maxFileLength` integer

## Response `200`

Temporary file created from URL successfully

- TempFilesView — Response body for /api/v1/temp and /api/v1/temp/byUrl uploads. Contains the tempFiles array; use tempFiles[0].id (e.g. "temp_5311313004") as the field value when creating contentlets with binary or image fields.
  - `tempFiles` DotTempFile[]
    - `id` string
    - `mimeType` string
    - `referenceUrl` string
    - `thumbnailUrl` string
    - `fileName` string
    - `folder` string
    - `image` boolean
    - `metadata` object
    - `length` integer

## Other responses

- `400` — Invalid URL, missing URL, or invalid origin/referer
- `401` — Authentication required (when anonymous access is disabled)
- `404` — Temp file resource is not enabled

---

[API](https://skmtc.dev/jostens/apis/dotcms-rest-api.md) · [All operations](https://skmtc.dev/jostens/apis/dotcms-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/jostens/dotcms-rest-api/revisions/a088fe9f515c/schema)
