# Create a new category queue

POST https://services.leadconnectorhq.com/social-media-posting/category/queues

Creates a queue in draft status for a category. Published posts are auto-added. Use update endpoint to activate.

## Authentication

Send `Authorization: Bearer <token>` using:

- **Sub-Account token: OAuth access token or Private Integration Token.** Scopes: `socialplanner/category.write`

## Parameters

### Header Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Version` | string | Yes | API Version |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "LeadConnector API",
    "version": "v3"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/social-media-posting/category/queues": {
      "post": {
        "summary": "Create a new category queue",
        "operationId": "createANewCategoryQueue",
        "description": "Creates a queue in draft status for a category. Published posts are auto-added. Use update endpoint to activate.",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "v3"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCategoryQueueDTO"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Queue created successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WrappedCreateCategoryQueueResponseDTO"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestDTO"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedDTO"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableDTO"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": [
              "socialplanner/category.write"
            ]
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account.",
        "type": "http"
      },
      "Agency-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency (OR) Private Integration Token of Agency.",
        "type": "http"
      },
      "Agency-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency.",
        "type": "http"
      }
    },
    "schemas": {
      "CreateCategoryQueueDTO": {
        "type": "object",
        "properties": {
          "locationId": {
            "type": "string",
            "description": "Location ID",
            "example": "609e126a1c4ae1001291e1b5"
          },
          "categoryId": {
            "type": "string",
            "description": "Category ID",
            "example": "60af88475f1b2c001f5d5f4b"
          },
          "timeSlots": {
            "description": "Time slots defining when posts should be published",
            "example": [
              {
                "dayOfWeek": 1,
                "time": "09:00"
              },
              {
                "dayOfWeek": 3,
                "time": "14:30"
              }
            ],
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "dayOfWeek": {
                  "type": "number",
                  "description": "Day of the week (0-6)",
                  "example": 0
                },
                "time": {
                  "type": "string",
                  "description": "Time in HH:mm format",
                  "example": "09:00"
                }
              },
              "required": [
                "dayOfWeek",
                "time"
              ],
              "title": "TimeSlotDTO"
            }
          },
          "enableFuturePosts": {
            "type": "boolean",
            "description": "Enable Future Posts. Defaults to false.",
            "example": true
          },
          "prioritizeNewContent": {
            "type": "boolean",
            "description": "Prioritize New Content. Defaults to false.",
            "example": false
          },
          "userId": {
            "type": "string",
            "description": "User id",
            "example": "w37swmmLbA02zgqKPpxITe"
          }
        },
        "required": [
          "locationId",
          "categoryId",
          "timeSlots",
          "userId"
        ],
        "title": "CreateCategoryQueueDTO"
      },
      "WrappedCreateCategoryQueueResponseDTO": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "description": "Success or Failure",
            "example": true
          },
          "statusCode": {
            "type": "number",
            "description": "Status Code",
            "example": 201
          },
          "results": {
            "description": "Response payload",
            "example": {
              "message": "Queue created successfully",
              "queue": {
                "_id": "686ebf10c78c233e45c28d66",
                "locationId": "Qp26qppJgfrTZis7jsBy",
                "categoryId": "683702938b19583ce320e5eb",
                "timeSlots": [
                  {
                    "_id": "686ebf10c78c23d665c28d67",
                    "dayOfWeek": 0,
                    "time": "00:00"
                  }
                ],
                "enableFuturePosts": true,
                "prioritizeNewContent": true,
                "status": "draft",
                "startDate": "2025-07-09T19:12:16.363Z",
                "skipDateTime": [],
                "totalPosts": 0,
                "lastScheduledTime": null,
                "createdBy": "uefV3MmLHs2sjJr2KfmL",
                "createdAt": "2025-07-09T19:12:16.366Z",
                "updatedAt": "2025-07-09T19:12:16.366Z"
              }
            },
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "message": {
                    "type": "string",
                    "example": "Queue created successfully",
                    "description": "Message"
                  },
                  "queue": {
                    "description": "The newly created queue.",
                    "example": {
                      "_id": "686ebf10c78c233e45c28d66",
                      "locationId": "Qp26qppJgfrTZis7jsBy",
                      "categoryId": "683702938b19583ce320e5eb",
                      "timeSlots": [
                        {
                          "_id": "686ebf10c78c23d665c28d67",
                          "dayOfWeek": 0,
                          "time": "00:00"
                        }
                      ],
                      "enableFuturePosts": true,
                      "prioritizeNewContent": true,
                      "status": "draft",
                      "startDate": "2025-07-09T19:12:16.363Z",
                      "skipDateTime": [],
                      "totalPosts": 0,
                      "lastScheduledTime": null,
                      "createdBy": "uefV3MmLHs2sjJr2KfmL",
                      "createdAt": "2025-07-09T19:12:16.366Z",
                      "updatedAt": "2025-07-09T19:12:16.366Z"
                    },
                    "allOf": [
                      {
                        "type": "object",
                        "properties": {
                          "_id": {
                            "type": "string",
                            "example": "686ebf10c78c233e45c28d66",
                            "description": "Queue ID"
                          },
                          "locationId": {
                            "type": "string",
                            "example": "Qp26qppJgfrTZis7jsBy",
                            "description": "Location ID"
                          },
                          "categoryId": {
                            "type": "string",
                            "example": "683702938b19583ce320e5eb",
                            "description": "Category ID"
                          },
                          "timeSlots": {
                            "description": "Time slots for scheduling posts",
                            "example": [
                              {
                                "_id": "686ebf10c78c23d665c28d67",
                                "dayOfWeek": 0,
                                "time": "00:00"
                              }
                            ],
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "_id": {
                                  "type": "string",
                                  "example": "686ebf10c78c23d665c28d67",
                                  "description": "Time slot ID"
                                },
                                "dayOfWeek": {
                                  "type": "number",
                                  "example": 0,
                                  "description": "Day of the week (0=Sunday, 1=Monday, ...)"
                                },
                                "time": {
                                  "type": "string",
                                  "example": "00:00",
                                  "description": "Time of the day (HH:mm format)"
                                }
                              },
                              "title": "CreatedTimeSlotDTO"
                            }
                          },
                          "enableFuturePosts": {
                            "type": "boolean",
                            "example": true,
                            "description": "Enable posting future content"
                          },
                          "prioritizeNewContent": {
                            "type": "boolean",
                            "example": true,
                            "description": "Prioritize new content over older content"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "active",
                              "paused",
                              "draft"
                            ],
                            "example": "draft",
                            "description": "Status of the queue. Always \"draft\" for a new queue."
                          },
                          "startDate": {
                            "format": "date-time",
                            "type": "string",
                            "example": "2025-07-09T19:12:16.363Z",
                            "description": "Start date of the queue"
                          },
                          "skipDateTime": {
                            "example": [],
                            "description": "Dates/times to skip posting. Always empty for a new queue.",
                            "type": "array",
                            "items": {
                              "format": "date-time",
                              "type": "string"
                            }
                          },
                          "totalPosts": {
                            "type": "number",
                            "example": 0,
                            "description": "Total number of posts in the queue. Always 0 for a new queue."
                          },
                          "lastScheduledTime": {
                            "format": "date-time",
                            "type": "string",
                            "example": null,
                            "description": "Timestamp of the last scheduled post. Always null for a new queue.",
                            "nullable": true
                          },
                          "createdBy": {
                            "type": "string",
                            "example": "uefV3MmLHs2sjJr2KfmL",
                            "description": "ID of the user who created the queue"
                          },
                          "createdAt": {
                            "format": "date-time",
                            "type": "string",
                            "example": "2025-07-09T19:12:16.366Z",
                            "description": "Creation timestamp"
                          },
                          "updatedAt": {
                            "format": "date-time",
                            "type": "string",
                            "example": "2025-07-09T19:12:16.366Z",
                            "description": "Last update timestamp"
                          }
                        },
                        "title": "CreatedCategoryQueueDTO"
                      }
                    ]
                  }
                },
                "title": "CreateCategoryQueueResponseDTO"
              }
            ]
          },
          "traceId": {
            "type": "string",
            "description": "Trace ID for debugging",
            "example": "TRACE-abc123-def456"
          }
        },
        "required": [
          "success",
          "statusCode",
          "results"
        ],
        "title": "WrappedCreateCategoryQueueResponseDTO"
      },
      "BadRequestDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 400
          },
          "message": {
            "type": "string",
            "example": "Bad Request"
          }
        },
        "title": "BadRequestDTO"
      },
      "UnauthorizedDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 401
          },
          "message": {
            "type": "string",
            "example": "Invalid token: access token is invalid"
          },
          "error": {
            "type": "string",
            "example": "Unauthorized"
          }
        },
        "title": "UnauthorizedDTO"
      },
      "UnprocessableDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 422
          },
          "message": {
            "example": [
              "Unprocessable Entity"
            ],
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "error": {
            "type": "string",
            "example": "Unprocessable Entity"
          }
        },
        "title": "UnprocessableDTO"
      }
    }
  }
}
```

## Code Examples

**cURL**

```bash
curl -L -X POST 'https://services.leadconnectorhq.com/social-media-posting/category/queues' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: v3' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "locationId": "609e126a1c4ae1001291e1b5",
  "categoryId": "60af88475f1b2c001f5d5f4b",
  "timeSlots": [
    {
      "dayOfWeek": 1,
      "time": "09:00"
    },
    {
      "dayOfWeek": 3,
      "time": "14:30"
    }
  ],
  "enableFuturePosts": true,
  "prioritizeNewContent": false,
  "userId": "w37swmmLbA02zgqKPpxITe"
}'
```

**Node.js**

```javascript
const options = {
  method: 'POST',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: 'v3',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
      "locationId": "609e126a1c4ae1001291e1b5",
      "categoryId": "60af88475f1b2c001f5d5f4b",
      "timeSlots": [
        {
          "dayOfWeek": 1,
          "time": "09:00"
        },
        {
          "dayOfWeek": 3,
          "time": "14:30"
        }
      ],
      "enableFuturePosts": true,
      "prioritizeNewContent": false,
      "userId": "w37swmmLbA02zgqKPpxITe"
  })
};

try {
  const response = await fetch('https://services.leadconnectorhq.com/social-media-posting/category/queues', options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/social-media-posting/category/queues"

headers = {
    "Authorization": "Bearer <TOKEN>",
    "Version": "v3"
}

payload = {
    "locationId": "609e126a1c4ae1001291e1b5",
    "categoryId": "60af88475f1b2c001f5d5f4b",
    "timeSlots": [
        {
            "dayOfWeek": 1,
            "time": "09:00"
        },
        {
            "dayOfWeek": 3,
            "time": "14:30"
        }
    ],
    "enableFuturePosts": true,
    "prioritizeNewContent": false,
    "userId": "w37swmmLbA02zgqKPpxITe"
}

response = requests.post(url, json=payload, headers=headers)
print(response.json())
```

**PHP**

```php
<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://services.leadconnectorhq.com/social-media-posting/category/queues',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: v3',
    'Content-Type: application/json',
  ],
  CURLOPT_POSTFIELDS => '{
  "locationId": "609e126a1c4ae1001291e1b5",
  "categoryId": "60af88475f1b2c001f5d5f4b",
  "timeSlots": [
    {
      "dayOfWeek": 1,
      "time": "09:00"
    },
    {
      "dayOfWeek": 3,
      "time": "14:30"
    }
  ],
  "enableFuturePosts": true,
  "prioritizeNewContent": false,
  "userId": "w37swmmLbA02zgqKPpxITe"
}',
]);

$response = curl_exec($curl);
curl_close($curl);
echo $response;
```

**Java**

```java
HttpResponse<String> response = Unirest
  .post("https://services.leadconnectorhq.com/social-media-posting/category/queues")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "v3")
  .header("Content-Type", "application/json")
  .body("{\"locationId\":\"609e126a1c4ae1001291e1b5\",\"categoryId\":\"60af88475f1b2c001f5d5f4b\",\"timeSlots\":[{\"dayOfWeek\":1,\"time\":\"09:00\"},{\"dayOfWeek\":3,\"time\":\"14:30\"}],\"enableFuturePosts\":true,\"prioritizeNewContent\":false,\"userId\":\"w37swmmLbA02zgqKPpxITe\"}")
  .asString();
```

**Go**

```go
package main

import (
  "fmt"
  "net/http"
  "io"
  "strings"
)

func main() {
  url := "https://services.leadconnectorhq.com/social-media-posting/category/queues"
  payload := strings.NewReader(`{
  "locationId": "609e126a1c4ae1001291e1b5",
  "categoryId": "60af88475f1b2c001f5d5f4b",
  "timeSlots": [
    {
      "dayOfWeek": 1,
      "time": "09:00"
    },
    {
      "dayOfWeek": 3,
      "time": "14:30"
    }
  ],
  "enableFuturePosts": true,
  "prioritizeNewContent": false,
  "userId": "w37swmmLbA02zgqKPpxITe"
}`)
  req, _ := http.NewRequest("POST", url, payload)
  req.Header.Add("Authorization", "Bearer <TOKEN>")
  req.Header.Add("Version", "v3")

  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := io.ReadAll(res.Body)
  fmt.Println(string(body))
}
```

**Ruby**

```ruby
require 'uri'
require 'net/http'

url = URI("https://services.leadconnectorhq.com/social-media-posting/category/queues")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer <TOKEN>"
request["Version"] = "v3"
request["Content-Type"] = "application/json"
request.body = '{
  "locationId": "609e126a1c4ae1001291e1b5",
  "categoryId": "60af88475f1b2c001f5d5f4b",
  "timeSlots": [
    {
      "dayOfWeek": 1,
      "time": "09:00"
    },
    {
      "dayOfWeek": 3,
      "time": "14:30"
    }
  ],
  "enableFuturePosts": true,
  "prioritizeNewContent": false,
  "userId": "w37swmmLbA02zgqKPpxITe"
}'

response = http.request(request)
puts response.read_body
```

**PowerShell**

```powershell
$headers = @{
  "Authorization" = "Bearer <TOKEN>"
  "Version" = "v3"
}

$body = '{
  "locationId": "609e126a1c4ae1001291e1b5",
  "categoryId": "60af88475f1b2c001f5d5f4b",
  "timeSlots": [
    {
      "dayOfWeek": 1,
      "time": "09:00"
    },
    {
      "dayOfWeek": 3,
      "time": "14:30"
    }
  ],
  "enableFuturePosts": true,
  "prioritizeNewContent": false,
  "userId": "w37swmmLbA02zgqKPpxITe"
}'

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/social-media-posting/category/queues' -Method 'POST' -Headers $headers -Body $body -ContentType 'application/json'
$response | ConvertTo-Json
```
