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

# Process Photos

> Trigger AI photo processing (watermark, BIB detection, face indexing) for an event

## Overview

Triggers AI processing for imported photos — watermarking, BIB number detection, and face indexing depending on the event configuration. This is pipeline step 2, after [Import](/api-reference/pipeline/photos/import).

The job is asynchronous: this endpoint only queues work. The response returns `status: "processing"` and a `run_id`; track completion with [Pipeline Status](/api-reference/pipeline/photos/status) via `stages.process.status` (`processed`, `partially_processed`, or `failed`).

<Warning>
  Credits are deducted immediately when the job is queued. If AI features (selfie search or BIB search) are enabled, each image consumes one credit. Ensure your account has sufficient credits before calling this endpoint.
</Warning>

## Endpoint

```
POST /api/v1/ext/{org_id}/event/{event_id}/pipeline/photos/process
```

## Path Parameters

| Parameter  | Type   | Required | Description                      |
| ---------- | ------ | -------- | -------------------------------- |
| `org_id`   | number | Yes      | Your organisation ID.            |
| `event_id` | number | Yes      | The event to process photos for. |

## Request Body

| Field   | Type   | Required | Description                                                                                                                                  |
| ------- | ------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `count` | number | No       | Maximum number of images to process in this run (default: `2000`). The actual count is capped to the number of unprocessed images available. |

## Example Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -i -X POST \
    -H "X-API-Key: <your_9pic_api_key>" \
    -H "Content-Type: application/json" \
    -d '{"count": 500}' \
    "https://api.9pic.ai/api/v1/ext/903/event/456/pipeline/photos/process"
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      "https://api.9pic.ai/api/v1/ext/903/event/456/pipeline/photos/process",
      headers={
          "X-API-Key": "<your_9pic_api_key>",
          "Content-Type": "application/json",
      },
      json={"count": 500},
  )
  print(response.status_code, response.json())
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    "https://api.9pic.ai/api/v1/ext/903/event/456/pipeline/photos/process",
    {
      method: "POST",
      headers: {
        "X-API-Key": "<your_9pic_api_key>",
        "Content-Type": "application/json",
      },
      body: JSON.stringify({ count: 500 }),
    }
  );
  console.log(await response.json());
  ```
</CodeGroup>

## Example Response

```json theme={null}
{
  "responseType": "success",
  "message": "Processing started",
  "data": {
    "event_id": 456,
    "media": "photos",
    "stage": "process",
    "status": "processing",
    "run_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "requested_count": 500,
    "effective_count": 500,
    "credits_consumed": 500
  }
}
```

<Note>
  `credits_consumed` is `0` when neither selfie search nor BIB search is enabled for the event. `effective_count` is the number actually queued (may be lower than `requested_count` when fewer unprocessed images remain).
</Note>

## Error Responses

| Status | Meaning                                                                                     |
| ------ | ------------------------------------------------------------------------------------------- |
| `400`  | No unprocessed images available. Run [Import](/api-reference/pipeline/photos/import) first. |
| `401`  | API key is missing.                                                                         |
| `402`  | Insufficient credits. Top up your account in the dashboard.                                 |
| `403`  | API key is invalid, inactive, or token/event ownership mismatch.                            |
| `404`  | Event configuration not found.                                                              |
| `409`  | Process is already running. Wait for it to complete.                                        |
| `429`  | Rate limit exceeded. Back off and retry.                                                    |
| `500`  | Internal failure — the processing job could not be queued.                                  |

See [Errors](/api-reference/errors) for canonical descriptions and retry guidance.
