# Process files from a URL

Use any public or signed HTTP URL as input for processing

Any reachable HTTP or HTTPS URL works as input. No connections, no credentials setup -- just pass the URL.

"Folio" (a headless CMS platform like Contentful) stores media across CDNs, cloud buckets, and user-provided links. Every source is just a URL.

## API

<CodeGroup labels={["CLI", "TypeScript", "Python", "curl"]}>
```bash
ittybit video \
  -i https://cdn.folio-cms.com/assets/hero-video.mov \
  --width 1280 \
  --format mp4
```

```typescript
const task = {
  input: 'https://cdn.folio-cms.com/assets/hero-video.mov',
  kind: 'video',
  options: {
    width: 1280,
    format: 'mp4',
  },
};

const res = await fetch('https://api.ittybit.com/jobs', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.ITTYBIT_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(task),
});
const data = await res.json();
```

```python

task = {
    "input": "https://cdn.folio-cms.com/assets/hero-video.mov",
    "kind": "video",
    "options": {
        "width": 1280,
        "format": "mp4",
    },
}

res = requests.post(
    "https://api.ittybit.com/jobs",
    headers={"Authorization": f"Bearer {api_key}"},
    json=task,
)
data = res.json()
```

```bash
TASK='{
  "input": "https://cdn.folio-cms.com/assets/hero-video.mov",
  "kind": "video",
  "options": {
    "width": 1280,
    "format": "mp4"
  }
}'

curl -X POST https://api.ittybit.com/jobs \
  -H "Authorization: Bearer $ITTYBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d "$TASK"
```

</CodeGroup>

Ittybit fetches the file, processes it, and delivers the output to the CDN. No bucket setup required.

## CLI

```bash
ittybit video \
  -i https://cdn.folio-cms.com/assets/hero-video.mov \
  -o hero.mp4 \
  --width 1280
```

## Presigned URLs

Private files behind presigned URLs work the same way. The full signed URL is the input:

<CodeGroup labels={["CLI", "TypeScript", "Python", "curl"]}>
```bash
ittybit video \
  -i "https://my-bucket.s3.amazonaws.com/uploads/video.mov?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=...&X-Amz-Signature=abc123" \
  --width 1280 \
  --format mp4
```

```typescript
const presignedUrl =
  'https://my-bucket.s3.amazonaws.com/uploads/video.mov?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=...&X-Amz-Signature=abc123';

const task = {
  input: presignedUrl,
  kind: 'video',
  options: {
    width: 1280,
    format: 'mp4',
  },
};

const res = await fetch('https://api.ittybit.com/jobs', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.ITTYBIT_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(task),
});
const data = await res.json();
```

```python

presigned_url = (
    "https://my-bucket.s3.amazonaws.com/uploads/video.mov"
    "?X-Amz-Algorithm=AWS4-HMAC-SHA256"
    "&X-Amz-Credential=...&X-Amz-Signature=abc123"
)

task = {
    "input": presigned_url,
    "kind": "video",
    "options": {
        "width": 1280,
        "format": "mp4",
    },
}

res = requests.post(
    "https://api.ittybit.com/jobs",
    headers={"Authorization": f"Bearer {api_key}"},
    json=task,
)
data = res.json()
```

```bash
TASK='{
  "input": "https://my-bucket.s3.amazonaws.com/uploads/video.mov?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=...&X-Amz-Signature=abc123",
  "kind": "video",
  "options": {
    "width": 1280,
    "format": "mp4"
  }
}'

curl -X POST https://api.ittybit.com/jobs \
  -H "Authorization: Bearer $ITTYBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d "$TASK"
```

</CodeGroup>

Make sure presigned URLs have enough expiry time for Ittybit to fetch the file. A few hours is safe.

## URL sources

Any URL that returns bytes works:

| Source           | Example                                                          |
| ---------------- | ---------------------------------------------------------------- |
| CDN              | `https://cdn.example.com/video.mp4`                              |
| Presigned S3     | `https://bucket.s3.amazonaws.com/key?X-Amz-Signature=...`        |
| Presigned GCS    | `https://storage.googleapis.com/bucket/key?X-Goog-Signature=...` |
| Direct link      | `https://example.com/downloads/file.mov`                         |
| R2 public bucket | `https://pub-abc123.r2.dev/video.mp4`                            |

If you need to read from a private bucket without presigned URLs, set up a connection instead. See [Process files from S3](/guides/process-files-from-s3).