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

# Update Schedule

> Update the scheduled time or platform data of a pending post

<Note>
  **Try it out!** Use the API playground on the right to test the Update Schedule endpoint directly.
</Note>

## Overview

Update a scheduled post to change its publishing time or platform metadata. This is useful for:

* Rescheduling a post to a different time
* Updating the title, description, or tags before publishing
* Changing privacy settings

<Warning>
  You can only update posts with `pending` status. Published or failed posts cannot be modified.
</Warning>

***

## Endpoint

```
PATCH /v1/schedule/{scheduleId}
```

***

## Path Parameters

<ParamField path="scheduleId" type="string" required>
  The unique ID of the scheduled post to update
</ParamField>

***

## Headers

<ParamField header="x-api-key" type="string" required>
  Your API key from [API Settings](https://hooked.so/settings/api)
</ParamField>

***

## Request Body

<ParamField body="scheduledDateTime" type="string">
  New ISO 8601 datetime for publishing. Must be in the future.

  Example: `2024-03-20T16:00:00.000Z`
</ParamField>

<ParamField body="platformData" type="object">
  Updated platform-specific metadata. Fields are merged with existing data.

  <Expandable title="Platform Data Object">
    <ParamField body="title" type="string">
      New post title (max 100 characters)
    </ParamField>

    <ParamField body="description" type="string">
      New post description (max 5000 characters)
    </ParamField>

    <ParamField body="tags" type="array">
      New tags array (max 30 tags). Replaces existing tags.
    </ParamField>

    <ParamField body="privacyStatus" type="string">
      New privacy setting: `public`, `unlisted`, or `private`
    </ParamField>

    <ParamField body="madeForKids" type="boolean">
      Update kids content flag (YouTube only)
    </ParamField>
  </Expandable>
</ParamField>

***

## Request Examples

### Reschedule to Different Time

```javascript theme={null}
const scheduleId = 'post_abc123xyz';

const response = await fetch(`https://api.hooked.so/v1/schedule/${scheduleId}`, {
  method: 'PATCH',
  headers: {
    'x-api-key': process.env.HOOKED_API_KEY,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    scheduledDateTime: '2024-03-20T16:00:00.000Z'
  })
});

const data = await response.json();
console.log('New scheduled time:', data.data.scheduledDateTime);
```

### Update Platform Metadata

```javascript theme={null}
const scheduleId = 'post_abc123xyz';

const response = await fetch(`https://api.hooked.so/v1/schedule/${scheduleId}`, {
  method: 'PATCH',
  headers: {
    'x-api-key': process.env.HOOKED_API_KEY,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    platformData: {
      title: 'Updated: 10 Amazing Productivity Tips',
      description: 'I updated this video with even better tips!\n\nWatch to learn more...',
      tags: ['productivity', 'tips', 'updated', '2024']
    }
  })
});
```

### Update Both Time and Metadata

```javascript theme={null}
const scheduleId = 'post_abc123xyz';

const response = await fetch(`https://api.hooked.so/v1/schedule/${scheduleId}`, {
  method: 'PATCH',
  headers: {
    'x-api-key': process.env.HOOKED_API_KEY,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    scheduledDateTime: '2024-03-20T18:00:00.000Z',
    platformData: {
      title: 'Evening Edition: Productivity Tips',
      privacyStatus: 'unlisted'
    }
  })
});
```

<RequestExample>
  ```bash cURL theme={null}
  curl -X PATCH "https://api.hooked.so/v1/schedule/post_abc123xyz" \
    -H "x-api-key: your_api_key_here" \
    -H "Content-Type: application/json" \
    -d '{
      "scheduledDateTime": "2024-03-20T16:00:00.000Z",
      "platformData": {
        "title": "Updated Title",
        "description": "Updated description with more details"
      }
    }'
  ```

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

  schedule_id = 'post_abc123xyz'

  response = requests.patch(
      f'https://api.hooked.so/v1/schedule/{schedule_id}',
      headers={
          'x-api-key': 'your_api_key_here',
          'Content-Type': 'application/json'
      },
      json={
          'scheduledDateTime': '2024-03-20T16:00:00.000Z',
          'platformData': {
              'title': 'Updated Title',
              'description': 'Updated description'
          }
      }
  )

  data = response.json()
  print('Updated:', data['data'])
  ```

  ```php PHP theme={null}
  $scheduleId = 'post_abc123xyz';

  $ch = curl_init();
  curl_setopt_array($ch, [
      CURLOPT_URL => "https://api.hooked.so/v1/schedule/{$scheduleId}",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_CUSTOMREQUEST => 'PATCH',
      CURLOPT_HTTPHEADER => [
          'x-api-key: your_api_key_here',
          'Content-Type: application/json'
      ],
      CURLOPT_POSTFIELDS => json_encode([
          'scheduledDateTime' => '2024-03-20T16:00:00.000Z',
          'platformData' => [
              'title' => 'Updated Title'
          ]
      ])
  ]);

  $response = curl_exec($ch);
  curl_close($ch);

  $data = json_decode($response, true);
  print_r($data);
  ```
</RequestExample>

***

## Response

<ResponseExample>
  ```json Success Response theme={null}
  {
    "success": true,
    "message": "Schedule updated successfully",
    "data": {
      "id": "post_abc123xyz",
      "status": "pending",
      "scheduledDateTime": "2024-03-20T16:00:00.000Z",
      "platformData": {
        "title": "Updated Title",
        "description": "Updated description with more details",
        "tags": ["productivity", "tips"],
        "privacyStatus": "public"
      }
    }
  }
  ```

  ```json Error - Already Published theme={null}
  {
    "code": "bad_request",
    "message": "Cannot update a published post",
    "details": {}
  }
  ```

  ```json Error - Time in Past theme={null}
  {
    "code": "bad_request",
    "message": "Scheduled time must be in the future",
    "details": {
      "scheduledDateTime": "2024-03-01T14:00:00.000Z",
      "currentTime": "2024-03-10T10:00:00.000Z"
    }
  }
  ```

  ```json Error - Not Found theme={null}
  {
    "code": "not_found",
    "message": "Schedule not found",
    "details": {
      "resource_id": "post_invalid",
      "resource_type": "Schedule"
    }
  }
  ```

  ```json Error - No Fields theme={null}
  {
    "code": "bad_request",
    "message": "No fields to update",
    "details": {}
  }
  ```
</ResponseExample>

***

## Important Notes

<Info>
  **Metadata Merging**: When updating `platformData`, the new fields are merged with existing data. To remove a field, you need to set it explicitly to `null` or an empty value.
</Info>

<Warning>
  **Tags Replacement**: The `tags` array is replaced entirely, not merged. If you want to add a tag, include all existing tags plus the new one.
</Warning>

***

## Error Handling

| Error                                   | Description            | Solution                             |
| --------------------------------------- | ---------------------- | ------------------------------------ |
| `Schedule not found`                    | Invalid schedule ID    | Use a valid schedule ID              |
| `Cannot update a published post`        | Post already published | Cannot modify after publishing       |
| `Scheduled time must be in the future`  | Time has passed        | Use a future datetime                |
| `No fields to update`                   | Empty request body     | Include at least one field to update |
| `Schedule does not belong to your team` | Wrong team             | Use correct API key                  |

***

## Next Steps

<CardGroup cols={2}>
  <Card title="Get Details" icon="eye" href="/api-reference/schedule/details">
    View full schedule information
  </Card>

  <Card title="Cancel Schedule" icon="trash" href="/api-reference/schedule/delete">
    Cancel the scheduled post
  </Card>

  <Card title="List All" icon="list" href="/api-reference/schedule/list">
    View all scheduled posts
  </Card>

  <Card title="Create New" icon="plus" href="/api-reference/schedule/create">
    Schedule another video
  </Card>
</CardGroup>


## OpenAPI

````yaml PATCH /v1/schedule/{scheduleId}
openapi: 3.0.0
info:
  title: Hooked API
  version: 1.0.0
  description: AI Video Generation API
servers:
  - url: https://api.hooked.so
security:
  - ApiKeyAuth: []
paths:
  /v1/schedule/{scheduleId}:
    patch:
      tags:
        - Scheduling
      summary: Update Schedule
      description: Update the scheduled time or platform data of a pending post
      operationId: updateSchedule
      parameters:
        - name: scheduleId
          in: path
          description: Schedule ID
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                scheduledDateTime:
                  type: string
                  format: date-time
                  description: New ISO 8601 datetime for publishing
                platformData:
                  type: object
                  properties:
                    title:
                      type: string
                      maxLength: 100
                    description:
                      type: string
                      maxLength: 5000
                    tags:
                      type: array
                      items:
                        type: string
                      maxItems: 30
                    privacyStatus:
                      type: string
                      enum:
                        - public
                        - private
                        - unlisted
                    madeForKids:
                      type: boolean
      responses:
        '200':
          description: Schedule updated successfully
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````