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

# Delete Account

> Delete a social media account from your workspace

## Delete Account

Deletes a social media account from your workspace. This action cannot be undone and will remove the account from all future posts.

### Request

<ParamField path="id" type="integer" required>
  The ID of the account to delete
</ParamField>

<RequestExample>
  ```bash theme={null}
  curl -X DELETE "https://postsyncer.com/api/v1/accounts/123" \
    -H "Authorization: Bearer YOUR_API_TOKEN"
  ```
</RequestExample>

### Response

<ResponseField name="message" type="string">
  Account deleted successfully
</ResponseField>

<ResponseExample>
  ```json theme={null}
  {
    "message": "Account deleted successfully"
  }
  ```
</ResponseExample>

### Code Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X DELETE "https://postsyncer.com/api/v1/accounts/123" \
    -H "Authorization: Bearer YOUR_API_TOKEN"
  ```

  ```javascript Node.js theme={null}
  const axios = require('axios');

  const deleteAccount = async (accountId) => {
    try {
      const response = await axios.delete(`https://postsyncer.com/api/v1/accounts/${accountId}`, {
        headers: {
          'Authorization': 'Bearer YOUR_API_TOKEN'
        }
      });
      
      console.log('Account deleted:', response.data.message);
    } catch (error) {
      console.error('Error deleting account:', error.response?.data || error.message);
    }
  };

  deleteAccount(123);
  ```

  ```php PHP theme={null}
  <?php

  $accountId = 123;

  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, "https://postsyncer.com/api/v1/accounts/{$accountId}");
  curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
  curl_setopt($ch, CURLOPT_HTTPHEADER, [
      'Authorization: Bearer YOUR_API_TOKEN'
  ]);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

  $response = curl_exec($ch);
  $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
  curl_close($ch);

  if ($httpCode === 200) {
      $result = json_decode($response, true);
      echo $result['message'];
  } else {
      echo "Error: " . $response;
  }
  ?>
  ```

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

  account_id = 123
  headers = {
      'Authorization': 'Bearer YOUR_API_TOKEN'
  }

  response = requests.delete(
      f'https://postsyncer.com/api/v1/accounts/{account_id}',
      headers=headers
  )

  if response.status_code == 200:
      result = response.json()
      print(result['message'])
  else:
      print(f"Error: {response.status_code}")
      print(response.text)
  ```
</CodeGroup>

### Error Codes

<ResponseField name="401" type="Unauthorized">
  Missing or invalid API token
</ResponseField>

<ResponseField name="403" type="Forbidden">
  Token does not have 'accounts' permission
</ResponseField>

<ResponseField name="404" type="Not Found">
  Account not found or user does not have access to the account's workspace
</ResponseField>

<ResponseField name="422" type="Unprocessable Entity">
  Invalid account ID provided
</ResponseField>
