> ## 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.

# Disconnect Integration

> Remove a connected social media platform

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

## Overview

Disconnect a social media platform from your account. This removes the connection and all associated tokens.

<Warning>
  **This action is permanent.** Once disconnected:

  * All pending scheduled posts for this platform will fail
  * You'll need to reconnect through the dashboard to post again
  * Historical post data will be preserved
</Warning>

***

## Endpoint

```
DELETE /v1/integration/{integrationId}
```

***

## Path Parameters

<ParamField path="integrationId" type="string" required>
  The unique ID of the integration to disconnect
</ParamField>

***

## Headers

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

***

## Response

<ResponseField name="success" type="boolean">
  Whether the request was successful
</ResponseField>

<ResponseField name="message" type="string">
  Status message
</ResponseField>

<ResponseField name="data" type="object">
  <Expandable title="Data Object">
    <ResponseField name="id" type="string">
      ID of the disconnected integration
    </ResponseField>

    <ResponseField name="type" type="string">
      Platform type that was disconnected
    </ResponseField>

    <ResponseField name="deleted" type="boolean">
      Confirmation of deletion (always `true`)
    </ResponseField>
  </Expandable>
</ResponseField>

***

## Request Example

<RequestExample>
  ```bash cURL theme={null}
  curl -X DELETE "https://api.hooked.so/v1/integration/int_yt_abc123" \
    -H "x-api-key: your_api_key_here"
  ```

  ```javascript Node.js theme={null}
  const integrationId = 'int_yt_abc123';

  const response = await fetch(`https://api.hooked.so/v1/integration/${integrationId}`, {
    method: 'DELETE',
    headers: {
      'x-api-key': process.env.HOOKED_API_KEY
    }
  });

  const data = await response.json();

  if (data.success) {
    console.log(`Disconnected ${data.data.type} integration`);
  }
  ```

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

  integration_id = 'int_yt_abc123'

  response = requests.delete(
      f'https://api.hooked.so/v1/integration/{integration_id}',
      headers={'x-api-key': 'your_api_key_here'}
  )

  data = response.json()

  if data['success']:
      print(f"Disconnected {data['data']['type']} integration")
  ```

  ```php PHP theme={null}
  $integrationId = 'int_yt_abc123';

  $ch = curl_init();
  curl_setopt_array($ch, [
      CURLOPT_URL => "https://api.hooked.so/v1/integration/{$integrationId}",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_CUSTOMREQUEST => 'DELETE',
      CURLOPT_HTTPHEADER => [
          'x-api-key: your_api_key_here'
      ]
  ]);

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

  $data = json_decode($response, true);

  if ($data['success']) {
      echo "Disconnected " . $data['data']['type'] . " integration";
  }
  ```
</RequestExample>

***

## Response Examples

<ResponseExample>
  ```json Success Response theme={null}
  {
    "success": true,
    "message": "Integration disconnected successfully",
    "data": {
      "id": "int_yt_abc123",
      "type": "youtube",
      "deleted": true
    }
  }
  ```

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

  ```json Error - Forbidden theme={null}
  {
    "code": "forbidden",
    "message": "Integration does not belong to your team",
    "details": {}
  }
  ```
</ResponseExample>

***

## What Happens After Disconnection

### Pending Scheduled Posts

Any posts scheduled for this integration will:

1. Remain in `pending` status
2. Fail when their scheduled time arrives
3. Status will change to `failed` with an error message

**Recommendation:** Cancel any pending scheduled posts before disconnecting:

```javascript theme={null}
async function disconnectSafely(integrationId) {
  // 1. Get all pending posts for this integration
  const postsResponse = await fetch(
    `https://api.hooked.so/v1/schedule/list?status=pending`,
    { headers: { 'x-api-key': process.env.HOOKED_API_KEY } }
  );

  const { data: { scheduledPosts } } = await postsResponse.json();

  // 2. Filter posts for this integration
  const affectedPosts = scheduledPosts.filter(
    post => post.integration.id === integrationId
  );

  if (affectedPosts.length > 0) {
    console.log(`Warning: ${affectedPosts.length} pending posts will fail`);

    // Optional: Cancel them first
    for (const post of affectedPosts) {
      await fetch(`https://api.hooked.so/v1/schedule/${post.id}`, {
        method: 'DELETE',
        headers: { 'x-api-key': process.env.HOOKED_API_KEY }
      });
    }
  }

  // 3. Disconnect the integration
  const response = await fetch(
    `https://api.hooked.so/v1/integration/${integrationId}`,
    {
      method: 'DELETE',
      headers: { 'x-api-key': process.env.HOOKED_API_KEY }
    }
  );

  return await response.json();
}
```

### Historical Data

* Previously published posts remain on the platform
* Post history in Hooked is preserved for reference
* Analytics data is retained

***

## Reconnecting

To reconnect a platform after disconnecting:

1. Go to [Hooked Dashboard](https://hooked.so/settings/integrations)
2. Click **Connect** on the platform you want to add
3. Complete the OAuth authorization flow
4. A new integration ID will be generated

<Info>
  Reconnecting creates a **new integration** with a new ID. Update any stored integration IDs in your application.
</Info>

***

## Next Steps

<CardGroup cols={2}>
  <Card title="List Integrations" icon="list" href="/api-reference/integration/list">
    View remaining connected platforms
  </Card>

  <Card title="Connect New" icon="plug" href="https://hooked.so/settings/integrations">
    Add a new platform in dashboard
  </Card>

  <Card title="Cancel Schedules" icon="calendar-xmark" href="/api-reference/schedule/delete">
    Cancel pending posts
  </Card>

  <Card title="List Scheduled" icon="calendar" href="/api-reference/schedule/list">
    View scheduled posts
  </Card>
</CardGroup>


## OpenAPI

````yaml DELETE /v1/integration/{integrationId}
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/integration/{integrationId}:
    delete:
      tags:
        - Integrations
      summary: Disconnect Integration
      description: Remove a connected social media platform
      operationId: disconnectIntegration
      parameters:
        - name: integrationId
          in: path
          description: Integration ID
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Integration disconnected successfully
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````