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

# Create Video Post

> Create and schedule a video post to one or more accounts

## Request Body

<ParamField body="accountIds" type="array" required>
  Array of account IDs to post to (e.g., `["acc_123", "acc_456"]`).
</ParamField>

<ParamField body="contentUrl" type="string" required>
  URL of the video file to post.
</ParamField>

<ParamField body="caption" type="string">
  Post caption/description.
</ParamField>

<ParamField body="soundId" type="string">
  ID of a TikTok sound to attach to the post.

  **Platform Support:**

  * TikTok: Supported
  * Instagram: Not supported

  **Usage:**

  1. Import the audio using the [Upload Sound](/api-reference/media/upload-sound) endpoint with a TikTok video URL
  2. The endpoint returns a `soundId`
  3. Use that `soundId` in this field

  **Example workflow:**

  ```javascript theme={null}
  // Step 1: Import audio from a TikTok video
  const soundResponse = await fetch('https://api.infinipost.co/v1/media/sounds', {
    method: 'POST',
    headers: { 'Authorization': 'Bearer YOUR_API_KEY' },
    body: JSON.stringify({
      soundUrl: 'https://www.tiktok.com/@username/video/7123456789'
    })
  });
  const { soundId } = await soundResponse.json();

  // Step 2: Use the returned soundId in your post
  const postResponse = await fetch('https://api.infinipost.co/v1/posts/video', {
    method: 'POST',
    headers: { 'Authorization': 'Bearer YOUR_API_KEY' },
    body: JSON.stringify({
      accountIds: ['acc_123456'],
      contentUrl: 'https://example.com/video.mp4',
      soundId: soundId
    })
  });
  ```
</ParamField>

<ParamField body="markAI" type="boolean" default="false">
  When `true`, adds an AI-generated content label to the post.
</ParamField>

<ParamField body="scheduledTime" type="string">
  Local time to post, in `YYYY-MM-DDTHH:MM` format (e.g. `"2024-04-22T14:00"`). If not provided, posts immediately.

  Interpreted in the timezone specified by the `timezone` parameter.
</ParamField>

<ParamField body="timezone" type="string" default="America/New_York">
  IANA timezone for interpreting `scheduledTime`. Supported values:

  | Value                 | Label           |
  | --------------------- | --------------- |
  | `America/New_York`    | Eastern (ET)    |
  | `America/Chicago`     | Central (CT)    |
  | `America/Denver`      | Mountain (MT)   |
  | `America/Los_Angeles` | Pacific (PT)    |
  | `America/Anchorage`   | Alaska (AKT)    |
  | `Pacific/Honolulu`    | Hawaii (HST)    |
  | `Europe/London`       | London (GMT)    |
  | `Europe/Paris`        | Paris (CET)     |
  | `Asia/Tokyo`          | Tokyo (JST)     |
  | `Asia/Singapore`      | Singapore (SGT) |
  | `Australia/Sydney`    | Sydney (AEDT)   |
</ParamField>

## Response

<ResponseField name="posts" type="array">
  Array of created post objects (one per account).

  <Expandable title="properties">
    <ResponseField name="postId" type="string">
      Unique identifier for the post.
    </ResponseField>

    <ResponseField name="accountId" type="string">
      Account ID this post belongs to.
    </ResponseField>

    <ResponseField name="platform" type="string">
      Platform: `tiktok` or `instagram`.
    </ResponseField>

    <ResponseField name="status" type="string">
      Post status: `scheduled`, `processing`, `posted`, or `failed`.
    </ResponseField>

    <ResponseField name="scheduledTime" type="string">
      When the post is scheduled to go live.
    </ResponseField>

    <ResponseField name="createdAt" type="string">
      ISO 8601 timestamp of when the post was created.
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.infinipost.co/v1/posts/video \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "accountIds": ["acc_123", "acc_456"],
      "contentUrl": "https://example.com/video.mp4",
      "caption": "Check out this amazing content! #viral",
      "soundId": "sound_abc123",
      "markAI": false,
      "scheduledTime": "2024-04-22T14:00",
      "timezone": "America/New_York"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.infinipost.co/v1/posts/video', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      accountIds: ['acc_123', 'acc_456'],
      contentUrl: 'https://example.com/video.mp4',
      caption: 'Check out this amazing content! #viral',
      soundId: 'sound_abc123',
      markAI: false,
      scheduledTime: '2024-04-22T14:00',
      timezone: 'America/New_York'
    })
  });

  const data = await response.json();
  ```

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

  response = requests.post(
      'https://api.infinipost.co/v1/posts/video',
      headers={
          'Authorization': 'Bearer YOUR_API_KEY',
          'Content-Type': 'application/json'
      },
      json={
          'accountIds': ['acc_123', 'acc_456'],
          'contentUrl': 'https://example.com/video.mp4',
          'caption': 'Check out this amazing content! #viral',
          'soundId': 'sound_abc123',
          'markAI': False,
          'scheduledTime': '2024-04-22T14:00',
          'timezone': 'America/New_York'
      }
  )

  print(response.json())
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "posts": [
      {
        "postId": "post_abc123",
        "accountId": "acc_123",
        "platform": "tiktok",
        "status": "scheduled",
        "scheduledTime": "2024-04-22T14:00",
      "timezone": "America/New_York",
        "createdAt": "2024-04-21T20:15:00Z"
      },
      {
        "postId": "post_def456",
        "accountId": "acc_456",
        "platform": "instagram",
        "status": "scheduled",
        "scheduledTime": "2024-04-22T14:00",
      "timezone": "America/New_York",
        "createdAt": "2024-04-21T20:15:00Z"
      }
    ]
  }
  ```
</ResponseExample>

## Error Responses

```json Unauthorized theme={null}
{
  "error": {
    "code": "unauthenticated",
    "message": "Invalid or missing API key"
  }
}
```

```json Missing Required Fields theme={null}
{
  "error": {
    "code": "invalid_parameter",
    "message": "accountIds is required and must be a non-empty array"
  }
}
```

```json Account Not Found theme={null}
{
  "error": {
    "code": "not_found",
    "message": "Account(s) not found: acc_1a2b3c4d5e"
  }
}
```

```json Invalid Scheduled Time theme={null}
{
  "error": {
    "code": "invalid_parameter",
    "message": "scheduledTime must be a valid ISO 8601 timestamp"
  }
}
```

```json Server Error theme={null}
{
  "error": {
    "code": "internal",
    "message": "An unexpected error occurred"
  }
}
```
