---
title: "Join files into one"
---

> 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.

# Join files into one

Path: CloudRaker Paperwork API › Spaces

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

Joins 2 to 20 files, in the order you list them, into a single new file.

```json
{ "files": ["call-part1.mp3", "call-part2.mp3"] }
```

Each entry is a file id or a file name. Every file must be the same kind:

- **Audio** — the recordings are concatenated. `format` (`mp3`, `m4a` or `wav`) forces the output container; without it the inputs' own container is kept. The result is named `<first>.joined.<ext>`.
- **PDF** — the documents are merged into one. The result is named `<first>.merged.pdf`.

Mixing audio with PDFs answers `400`. The files must be under 40 MB in total, otherwise the call answers `413 too_large`.

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

## Authentication

- `bearerAuth`, http, header `Authorization`

## Path parameters

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

## Request body

_Required._

- `files` (`spaceStitchFiles.files`; array<string>, required)
  - minLength 1; example `["part1.mp3","part2.mp3"]`
- `format` (`spaceStitchFiles.format`; string, optional)
  - one of `"mp3"`, `"m4a"`, `"wav"`

## Example request

```json
{
  "files": [
    "part1.mp3",
    "part2.mp3"
  ],
  "format": "mp3"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url 'https://api.cloudraker.com/v1/spaces/<spaceId>/files/stitch' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "files": [
    "part1.mp3",
    "part2.mp3"
  ],
  "format": "mp3"
}
'
```

### TypeScript

```typescript
const url = 'https://api.cloudraker.com/v1/spaces/<spaceId>/files/stitch';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({files: ['part1.mp3', 'part2.mp3'], format: 'mp3'})
};

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/stitch"

payload = {
    "files": ["part1.mp3", "part2.mp3"],
    "format": "mp3"
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

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

print(response.text)
```

## Responses

### 201

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

### 400

Mixed or unsupported file types (`invalid_request`).

### 404

Unknown file.

### 409

Ambiguous name (`ambiguous_file_name`).

### 413

More than 40 MB in total (`too_large`).

### 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` (`spaceStitchFiles.response.429.code`; string, required)
  - one of `"rate_limited"`
- `message` (`spaceStitchFiles.response.429.message`; string, required)
- `retryable` (`spaceStitchFiles.response.429.retryable`; boolean, required)
  - one of `true`
- `requestId` (`spaceStitchFiles.response.429.requestId`; string, required)
- `docUrl` (`spaceStitchFiles.response.429.docUrl`; string, optional)


Source: https://docs.cloudraker.com/paperwork/api/spaces/space-stitch-files/index.md
