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

# Set Accounts

```http theme={null}
POST https://services.leadconnectorhq.com/social-media-posting/{locationId}/set-accounts
```

## Autorización

<ParamField header="Authorization" type="string" required>
  Bearer token generado desde el portal Leadway. Ver [Autenticación](/authentication).
</ParamField>

<ParamField header="Version" type="string" required default="2021-07-28">
  Versión de la API.
</ParamField>

## Path parameters

<ParamField path="locationId" type="string" required default="ve9EPM428h8vShlRW1KT">
  Account Id
</ParamField>

## Body

<ParamField body="accountIds" type="string[]" required>
  Account Ids
</ParamField>

<ParamField body="filePath" type="string" required default="o6241QsiRwUIJHyjuhos/social-planner-import/a6d04a26-0401-4e52-8f48-dbb274050fab.csv">
  File path
</ParamField>

<ParamField body="rowsCount" type="number" required default="1">
  Entires Count. rowcCount must be between 1 and number of posts in CSV
</ParamField>

<ParamField body="fileName" type="string" required default="test.csv">
  Name of file
</ParamField>

<ParamField body="approver" type="string" default="o6241QsiRwUIJHyjuhos" />

<ParamField body="userId" type="string" default="sdfdsfdsfEWEsdfsdsW32dd">
  User ID
</ParamField>

## Respuestas

<Accordion title="201 - Successful response">
  <ResponseField name="success" type="boolean" required default="True">
    Success or Failure
  </ResponseField>

  <ResponseField name="statusCode" type="number" required default="201">
    Status Code
  </ResponseField>

  <ResponseField name="message" type="string" required default="Accounts Set Successfully">
    Message
  </ResponseField>

  ```json theme={null}
  {
    "success": true,
    "statusCode": 201,
    "message": "Accounts Set Successfully"
  }
  ```
</Accordion>

<Accordion title="400 - Bad Request">
  ```json theme={null}
  {}
  ```
</Accordion>

<Accordion title="401 - Unauthorized">
  ```json theme={null}
  {}
  ```
</Accordion>

<Accordion title="422 - Unprocessable Entity">
  ```json theme={null}
  {}
  ```
</Accordion>

## Ejemplo

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST 'https://services.leadconnectorhq.com/social-media-posting/YOUR_locationId/set-accounts' \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    -H 'Version: 2021-07-28' \
    -H 'Content-Type: application/json' \
    -d '{
    "accountIds": [
      "aF3KhyL8JIuBwzK3m7Ly_iVrVJ2uoXNF0wzcBzgl5_12554616564525983496"
    ],
    "filePath": "o6241QsiRwUIJHyjuhos/social-planner-import/a6d04a26-0401-4e52-8f48-dbb274050fab.csv",
    "rowsCount": 1,
    "fileName": "test.csv",
    "approver": "o6241QsiRwUIJHyjuhos",
    "userId": "sdfdsfdsfEWEsdfsdsW32dd"
  }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://services.leadconnectorhq.com/social-media-posting/YOUR_locationId/set-accounts', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
      Version: '2021-07-28',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({"accountIds": ["aF3KhyL8JIuBwzK3m7Ly_iVrVJ2uoXNF0wzcBzgl5_12554616564525983496"], "filePath": "o6241QsiRwUIJHyjuhos/social-planner-import/a6d04a26-0401-4e52-8f48-dbb274050fab.csv", "rowsCount": 1, "fileName": "test.csv", "approver": "o6241QsiRwUIJHyjuhos", "userId": "sdfdsfdsfEWEsdfsdsW32dd"}),
  });
  const data = await response.json();
  ```

  ```python Python theme={null}
  import os, requests
  response = requests.request(
      'POST',
      'https://services.leadconnectorhq.com/social-media-posting/YOUR_locationId/set-accounts',
      headers={
          'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
          'Version': '2021-07-28',
          'Content-Type': 'application/json',
      },
      json={"accountIds": ["aF3KhyL8JIuBwzK3m7Ly_iVrVJ2uoXNF0wzcBzgl5_12554616564525983496"], "filePath": "o6241QsiRwUIJHyjuhos/social-planner-import/a6d04a26-0401-4e52-8f48-dbb274050fab.csv", "rowsCount": 1, "fileName": "test.csv", "approver": "o6241QsiRwUIJHyjuhos", "userId": "sdfdsfdsfEWEsdfsdsW32dd"},
  )
  data = response.json()
  ```

  ```php PHP theme={null}
  <?php
  $ch = curl_init('https://services.leadconnectorhq.com/social-media-posting/YOUR_locationId/set-accounts');
  curl_setopt_array($ch, [
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_CUSTOMREQUEST => 'POST',
      CURLOPT_HTTPHEADER => [
          'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
          'Version: 2021-07-28',
          'Content-Type: application/json',
      ],
      CURLOPT_POSTFIELDS => json_encode({'accountIds': ['aF3KhyL8JIuBwzK3m7Ly_iVrVJ2uoXNF0wzcBzgl5_12554616564525983496'], 'filePath': 'o6241QsiRwUIJHyjuhos/social-planner-import/a6d04a26-0401-4e52-8f48-dbb274050fab.csv', 'rowsCount': 1, 'fileName': 'test.csv', 'approver': 'o6241QsiRwUIJHyjuhos', 'userId': 'sdfdsfdsfEWEsdfsdsW32dd'}),
  ]);
  $data = json_decode(curl_exec($ch), true);
  ```
</CodeGroup>
