---
title: "Register a file by URL, or get a presigned upload URL"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.cloudraker.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Register a file by URL, or get a presigned upload URL

Path: CloudRaker Paperwork API › Spaces

`POST /v1/spaces/{spaceId}/files`

Adds a file to your reusable corpus, either by URL or by uploading the bytes yourself.

Two request shapes, both pure JSON — send one or the other, never both.

**By URL.** `{ url, name?, processing? }` registers the file and fetches it over http(s). The media type is sniffed from the response, so any `mimeType` you send is ignored. You get the file back with `status: "processing"`.

```json
{ "url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf", "name": "fw9.pdf" }
```

**By upload.** `{ name, mimeType, processing? }` reserves the record and returns `uploadUrl` plus `uploadExpiresAt` (15 minutes). `PUT` the bytes to that URL with a `Content-Type` header exactly equal to the `mimeType` you sent; parsing starts the moment they land.

```json
{ "name": "recording.mp3", "mimeType": "audio/mpeg" }
```

**Parsing engine** — `processing` accepts `auto` (the default, self-upgrades to OCR on scans), `ocr`, `simple`, `transcribe` and `transcribe_diarize`. Audio and video default to `transcribe_diarize`.

> **Note:** Files registered here are persistent — no TTL — and reusable across any number of runs as `file: { "id": "…" }`. That is what makes parse-once-run-many work: pass the same id to [extract](https://docs.cloudraker.com/paperwork/api/capabilities/extract), [redact](https://docs.cloudraker.com/paperwork/api/capabilities/redact) and [pipeline](https://docs.cloudraker.com/paperwork/api/capabilities/pipeline) without re-parsing.

**Learn more:** [Working with files](https://docs.cloudraker.com/paperwork/developers/files)

## Authentication

- `bearerAuth`, http, header `Authorization`

## Path parameters

- `spaceId` (`spaceCreateFile.path.spaceId`; string, required)

## Request body

_Required._

Any of:

- `object`
  - `url` (`spaceCreateFile.1.url`; string, required)
    - format `uri`; example `"https://example.com/invoice.pdf"`
  - `name` (`spaceCreateFile.1.name`; string, optional)
    - minLength 1
  - `processing` (`spaceCreateFile.1.processing`; string, optional)
    - one of `"auto"`, `"ocr"`, `"simple"`, `"transcribe"`, `"transcribe_diarize"`, `"none"`
- `object`
  - `name` (`spaceCreateFile.2.name`; string, required)
    - minLength 1; example `"recording.mp3"`
  - `mimeType` (`spaceCreateFile.2.mimeType`; string, required)
    - minLength 1; example `"audio/mpeg"`
  - `processing` (`spaceCreateFile.2.processing`; string, optional)
    - one of `"auto"`, `"ocr"`, `"simple"`, `"transcribe"`, `"transcribe_diarize"`, `"none"`

## Example request

```json
{
  "url": "https://example.com/invoice.pdf",
  "name": "string",
  "processing": "auto"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url 'https://api.cloudraker.com/v1/spaces/<spaceId>/files' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "url": "https://example.com/invoice.pdf",
  "name": "string",
  "processing": "auto"
}
'
```

### TypeScript

```typescript
const url = 'https://api.cloudraker.com/v1/spaces/<spaceId>/files';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({url: 'https://example.com/invoice.pdf', name: 'string', processing: 'auto'})
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.cloudraker.com/v1/spaces/<spaceId>/files"

payload = {
    "url": "https://example.com/invoice.pdf",
    "name": "string",
    "processing": "auto"
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 201

The registered file.

#### Example

```json
{
  "object": "file",
  "id": "string",
  "name": "string",
  "mimeType": "string",
  "status": "uploading",
  "createdAt": "string",
  "parentFileId": "string",
  "metadata": {
    "property1": "string",
    "property2": "string"
  },
  "error": "string",
  "uploadUrl": "string",
  "uploadExpiresAt": "string",
  "urls": {
    "content": "string",
    "markdown": "string",
    "json": "string"
  }
}
```

- `object` (`spaceCreateFile.response.201.object`; string, required)
- `id` (`spaceCreateFile.response.201.id`; string, required)
- `name` (`spaceCreateFile.response.201.name`; string, required)
- `mimeType` (`spaceCreateFile.response.201.mimeType`; string, required)
- `status` (`spaceCreateFile.response.201.status`; string, required)
  - one of `"uploading"`, `"processing"`, `"ready"`, `"failed"`
- `createdAt` (`spaceCreateFile.response.201.createdAt`; string, required)
- `parentFileId` (`spaceCreateFile.response.201.parentFileId`; string, optional)
- `metadata` (`spaceCreateFile.response.201.metadata`; map<string>, optional)
- `error` (`spaceCreateFile.response.201.error`; string, optional)
- `uploadUrl` (`spaceCreateFile.response.201.uploadUrl`; string, optional)
- `uploadExpiresAt` (`spaceCreateFile.response.201.uploadExpiresAt`; string, optional)
- `urls` (`spaceCreateFile.response.201.urls`; object, optional)
  - `content` (`spaceCreateFile.response.201.urls.content`; string, optional)
  - `markdown` (`spaceCreateFile.response.201.urls.markdown`; string, optional)
  - `json` (`spaceCreateFile.response.201.urls.json`; string, optional)

### 400

Validation Error

#### Example

```json
{
  "success": false,
  "error": [
    null
  ],
  "data": null
}
```

- `success` (`spaceCreateFile.response.400.success`; boolean, required)
  - one of `false`
- `error` (`spaceCreateFile.response.400.error`; array<unknown>, required)
- `data` (`spaceCreateFile.response.400.data`; unknown, required)

### 422

The URL could not be fetched (`file_fetch_failed`).

### 429

Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.

#### Example

```json
{
  "code": "rate_limited",
  "message": "string",
  "retryable": true,
  "requestId": "string",
  "docUrl": "string"
}
```

- `code` (`spaceCreateFile.response.429.code`; string, required)
  - one of `"rate_limited"`
- `message` (`spaceCreateFile.response.429.message`; string, required)
- `retryable` (`spaceCreateFile.response.429.retryable`; boolean, required)
  - one of `true`
- `requestId` (`spaceCreateFile.response.429.requestId`; string, required)
- `docUrl` (`spaceCreateFile.response.429.docUrl`; string, optional)

### 502

The fetched bytes could not be stored (`file_upload_failed`).


Source: https://docs.cloudraker.com/paperwork/api/spaces/space-create-file/index.md
