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

# Create Reference Content Upload URL

> Generate a pre-signed upload URL for judge reference content

## Authentication

**Required:** API Key authentication via `X-API-Key` header

## Request Body

<ParamField body="file_extension" type="string" required>
  The file extension of the content to upload. Must be between 1-10 characters.

  **Examples:** `mp4`, `jpg`, `png`, `wav`, `pdf`
</ParamField>

<ParamField body="file_name" type="string">
  Optional display name for the file (without extension). Max 50 characters. The name is sanitized to lowercase alphanumeric characters, hyphens, and underscores. If omitted, a random identifier is generated.

  **Examples:** `episode_1`, `intro_segment`
</ParamField>

## Request Example

### cURL

```bash theme={null}
curl -X POST "https://api.getpique.ai/v1/judges/reference_content" \
  -H "X-API-Key: pk_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "file_extension": "mp4",
    "file_name": "episode_1"
  }'
```

### JSON Body

```json theme={null}
{
  "file_extension": "mp4",
  "file_name": "episode_1"
}
```

## Response

<ResponseField name="upload_url" type="string">
  A pre-signed GCS (Google Cloud Storage) URL for uploading the reference content.

  This URL is valid for a limited time (15 minutes) and should be used with a PUT request to upload the file directly.
</ResponseField>

<ResponseField name="expires_at" type="string">
  ISO 8601 timestamp indicating when the upload URL expires (15 minutes from creation)
</ResponseField>

<ResponseField name="reference_content_uri" type="string">
  The GCS URI where the file will be stored. This can be used to reference the file in subsequent API call to create a judge.

  **Format:** `gs://bucket-name/path/to/file`
</ResponseField>

## Response Example

```json theme={null}
{
  "upload_url": "https://storage.googleapis.com/judge-artifacts/org_123/reference_uploads/abc123/episode_1.mp4?X-Goog-Algorithm=GOOG4-RSA-SHA256&X-Goog-Credential=...",
  "expires_at": "2024-01-15T11:30:00Z",
  "reference_content_uri": "gs://judge-artifacts/org_123/reference_uploads/abc123/episode_1.mp4"
}
```

## How to Upload Content

After receiving the response, use the `upload_url` to upload your file:

```bash theme={null}
curl -X PUT "<UPLOAD_URL_FROM_RESPONSE>" \
  -H "Content-Type: video/mp4" \
  -T your-file.mp4 \
```

## Important Notes

1. The upload URL expires after 15 minutes (see `expires_at` field)
2. The file must be uploaded using a PUT request
3. Set the appropriate `Content-Type` header when uploading
4. The `reference_content_uri` returned should be used to reference this content when creating a judge

## Error Responses

### 400 Bad Request

Invalid file extension or request format

### 401 Unauthorized

Missing or invalid API key

### 403 Forbidden

Organization does not have permission to upload reference content

### 500 Internal Server Error

Failed to generate upload URL due to server error
