# Write output to S3

Send processed files directly to your S3 bucket

By default, processed files go to Ittybit's CDN. If you want them in your own bucket, set an S3 output destination.

## API

<CodeGroup labels={["CLI", "TypeScript", "Python", "curl"]}>
```bash
ittybit video \
  -i https://example.com/uploads/video.mov \
  -o s3://my-media-bucket/processed/video.mp4 \
  --width 1280 \
  --format mp4
```

```typescript
const task = {
  input: 'https://example.com/uploads/video.mov',
  kind: 'video',
  options: {
    width: 1280,
    format: 'mp4',
  },
  output: 's3://my-media-bucket/processed/video.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://example.com/uploads/video.mov",
    "kind": "video",
    "options": {
        "width": 1280,
        "format": "mp4",
    },
    "output": "s3://my-media-bucket/processed/video.mp4",
}

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

```bash
TASK='{
  "input": "https://example.com/uploads/video.mov",
  "kind": "video",
  "options": {
    "width": 1280,
    "format": "mp4"
  },
  "output": "s3://my-media-bucket/processed/video.mp4"
}'

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

</CodeGroup>

The `output` field takes an `s3://` URL. The processed file lands directly in your bucket.

## CLI

```bash
ittybit video \
  -i video.mov \
  -o s3://my-media-bucket/processed/video.mp4 \
  --width 1280
```

## S3 to S3

Read from one bucket, write to another:

<CodeGroup labels={["CLI", "TypeScript", "Python", "curl"]}>
```bash
ittybit video \
  -i s3://raw-uploads/video.mov \
  -o s3://processed-media/video.mp4 \
  --width 1280 \
  --format mp4
```

```typescript
const task = {
  input: 's3://raw-uploads/video.mov',
  kind: 'video',
  options: {
    width: 1280,
    format: 'mp4',
  },
  output: 's3://processed-media/video.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": "s3://raw-uploads/video.mov",
    "kind": "video",
    "options": {
        "width": 1280,
        "format": "mp4",
    },
    "output": "s3://processed-media/video.mp4",
}

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

```bash
TASK='{
  "input": "s3://raw-uploads/video.mov",
  "kind": "video",
  "options": {
    "width": 1280,
    "format": "mp4"
  },
  "output": "s3://processed-media/video.mp4"
}'

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

</CodeGroup>

```bash
ittybit video \
  -i s3://raw-uploads/video.mov \
  -o s3://processed-media/video.mp4 \
  --width 1280
```

## Connection setup

You need a connection configured for the bucket. See [Process files from S3](/guides/process-files-from-s3) for setup instructions.