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

# Sync API

> VEO 3.1 synchronous API for real-time interactive scenarios

<Warning>
  Before starting, please register for APIYI and obtain an API key at [https://api.apiyi.com/token](https://api.apiyi.com/token) (copy token)
</Warning>

## Generate Video in Three Steps

<Steps>
  <Step title="Submit Video Generation Task">
    Use your API key to call the submit endpoint

    ```bash theme={null}
    curl -X POST "https://api.apiyi.com/veo/v1/api/video/submit" \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer your-api-key" \
      -d '{
        "prompt": "A small orange cat slowly walking in a sunny garden",
        "model": "veo3"
      }'
    ```
  </Step>

  <Step title="Record the Returned Task ID">
    The system will return task information

    ```json theme={null}
    {
      "success": true,
      "data": {
        "taskId": "veo3:b873872e-7358-4c2f-8d55-bd23f000e14e",
        "pollingUrl": "https://asyncdata.net/source/veo3:b873872e-7358-4c2f-8d55-bd23f000e14e",
        "status": "processing",
        "message": "Task submitted successfully"
      }
    }
    ```
  </Step>

  <Step title="Query Generation Result">
    Use the task ID to query status

    ```bash theme={null}
    curl -X GET "https://api.apiyi.com/veo/v1/api/video/status/veo3:b873872e-7358-4c2f-8d55-bd23f000e14e" \
      -H "Authorization: Bearer your-api-key"
    ```
  </Step>
</Steps>

## Authentication

All API requests must include a valid Bearer Token in the request header:

```bash theme={null}
Authorization: Bearer your-api-key
```

<Tip>
  **Security Reminder:** Do not expose your API key in client-side code. It's recommended to store it in server-side environment variables.
</Tip>

## Basic Request Examples

### Simple Text Generation

```bash theme={null}
curl -X POST "https://api.apiyi.com/veo/v1/api/video/submit" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer your-api-key" \
  -d '{
    "prompt": "A cat walking on a rainy night"
  }'
```

### Generation with Reference Images

```bash theme={null}
curl -X POST "https://api.apiyi.com/veo/v1/api/video/submit" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer your-api-key" \
  -d '{
    "prompt": "A cat walking on a rainy night, preparing to catch a mouse",
    "model": "veo3",
    "images": ["https://example.com/cat.png"],
    "enhance_prompt": true
  }'
```

## Handling Responses

### Task Submitted Successfully

```json theme={null}
{
  "success": true,
  "data": {
    "taskId": "veo3:b873872e-7358-4c2f-8d55-bd23f000e14e",
    "pollingUrl": "https://asyncdata.net/source/veo3:b873872e-7358-4c2f-8d55-bd23f000e14e",
    "status": "processing",
    "message": "Task submitted successfully"
  }
}
```

### Video Generation Complete

```json theme={null}
{
  "success": true,
  "data": {
    "taskId": "veo3:b873872e-7358-4c2f-8d55-bd23f000e14e",
    "status": "completed",
    "result": {
      "video_url": "https://filesystem.site/cdn/20250705/BFvep0SngrqIrN3yDSFChIXAz2mU0M.mp4",
      "video_media_id": "CAUSJGRlNzE5MzRhLTljMDgtNDE1Mi05NWVlLThjOTlhMTZlODUyYxokY2U4ZjNiYmUtNGFmZS00NTExLWI4ZDEtMGM1MTFkM2ZlNGIxIgNDQUUqJDJlNTY3OWUyLWQ2YmQtNGVlZS05ZTUwLWMyMWE0MWU3ZDYzNw"
    }
  }
}
```

## Polling Recommendations

<Note>
  **Recommended polling strategy:**

  * Polling interval: 10-15 seconds
  * Maximum wait time: 30 minutes
  * Implement exponential backoff strategy
</Note>

## Next Steps

<CardGroup cols={2}>
  <Card title="Async API" icon="hourglass" href="/en/api-capabilities/veo/async-api">
    View async API documentation, pricing, and code examples
  </Card>

  <Card title="VEO Overview" icon="video" href="/en/api-capabilities/veo/overview">
    Return to VEO 3.1 product overview
  </Card>
</CardGroup>
