# Get all categories with their queue status

GET https://services.leadconnectorhq.com/social-media-posting/category/queues/available-categories

Returns categories with status: "available" (no queue), "in_queue" (active/paused queue), or "draft" (queue in draft).

## Authentication

Send `Authorization: Bearer <token>` using:

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

## Parameters

### Header Parameters

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

### Query Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `locationId` | string | Yes | Location ID |
| `skip` | string | No | Number of items to skip |
| `limit` | string | No | Maximum number of items to return |
| `q` | string | No | Search query |

## 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/available-categories": {
      "get": {
        "summary": "Get all categories with their queue status",
        "operationId": "getAllCategoriesWithTheirQueueStatus",
        "description": "Returns categories with status: \"available\" (no queue), \"in_queue\" (active/paused queue), or \"draft\" (queue in draft).",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "v3"
              ]
            }
          },
          {
            "name": "locationId",
            "required": true,
            "in": "query",
            "description": "Location ID",
            "schema": {
              "example": "609e126a1c4ae1001291e1b5",
              "type": "string"
            }
          },
          {
            "name": "skip",
            "required": false,
            "in": "query",
            "description": "Number of items to skip",
            "schema": {
              "example": "0",
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum number of items to return",
            "schema": {
              "example": "10",
              "type": "string"
            }
          },
          {
            "name": "q",
            "required": false,
            "in": "query",
            "description": "Search query",
            "schema": {
              "example": "Marketing",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Available categories fetched successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WrappedFetchAvailableCategoriesResponseDTO"
                }
              }
            }
          },
          "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.readonly"
            ]
          }
        ]
      }
    }
  },
  "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": {
      "WrappedFetchAvailableCategoriesResponseDTO": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "description": "Success or Failure",
            "example": true
          },
          "statusCode": {
            "type": "number",
            "description": "Status Code",
            "example": 200
          },
          "results": {
            "description": "Response payload",
            "example": {
              "message": "Available categories fetched successfully",
              "categories": [
                {
                  "_id": "6756f381be2553245b08d30c",
                  "name": "Category Name",
                  "primaryColor": "#FFFFFF",
                  "secondaryColor": "#000000",
                  "deleted": false,
                  "locationId": "fvg1TXIiVxGcdOaL0riG",
                  "createdBy": "SQ6d63Va2PUbWEZ9k0TD",
                  "createdAt": "2024-12-09T13:41:21.385Z",
                  "updatedAt": "2024-12-09T13:41:21.385Z",
                  "publishedPostsCount": 80,
                  "status": "in_queue",
                  "queueDetails": {
                    "queueId": "67fc07c6d7657c9aee764762",
                    "prioritizeNewContent": false,
                    "enableFuturePosts": true
                  }
                }
              ],
              "meta": {
                "count": "100"
              }
            },
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "message": {
                    "type": "string",
                    "description": "Message",
                    "example": "Available categories fetched successfully"
                  },
                  "categories": {
                    "description": "List of categories with queue status",
                    "example": [
                      {
                        "_id": "6756f381be2553245b08d30c",
                        "name": "Category Name",
                        "primaryColor": "#FFFFFF",
                        "secondaryColor": "#000000",
                        "deleted": false,
                        "locationId": "fvg1TXIiVxGcdOaL0riG",
                        "createdBy": "SQ6d63Va2PUbWEZ9k0TD",
                        "createdAt": "2024-12-09T13:41:21.385Z",
                        "updatedAt": "2024-12-09T13:41:21.385Z",
                        "publishedPostsCount": 80,
                        "status": "in_queue",
                        "queueDetails": {
                          "queueId": "67fc07c6d7657c9aee764762",
                          "prioritizeNewContent": false,
                          "enableFuturePosts": true
                        }
                      }
                    ],
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "deleted": {
                          "type": "boolean",
                          "description": "Indicates if deleted",
                          "example": false
                        },
                        "_id": {
                          "type": "string",
                          "description": "Category ID",
                          "example": "65cb3d2f68baa617aa0c286e"
                        },
                        "name": {
                          "type": "string",
                          "description": "Category name",
                          "example": "Facebook Reel"
                        },
                        "locationId": {
                          "type": "string",
                          "description": "Location ID",
                          "example": "fvg1TXIiVxGcdOaL0riG"
                        },
                        "primaryColor": {
                          "type": "string",
                          "description": "Primary color (hex)",
                          "example": "#004EEB"
                        },
                        "secondaryColor": {
                          "type": "string",
                          "description": "Secondary color (hex)",
                          "example": "#EFF4FF"
                        },
                        "createdBy": {
                          "type": "string",
                          "description": "Creator user ID",
                          "example": "SQ6d63Va2PUbWEZ9k0TD"
                        },
                        "createdAt": {
                          "type": "string",
                          "description": "Creation timestamp",
                          "example": "2024-02-13T09:58:07.129Z"
                        },
                        "updatedAt": {
                          "type": "string",
                          "description": "Last update timestamp",
                          "example": "2024-02-13T09:58:07.129Z"
                        },
                        "publishedPostsCount": {
                          "type": "number",
                          "description": "Published posts count",
                          "example": 80
                        },
                        "status": {
                          "type": "string",
                          "description": "Status: available (no queue), in_queue (active/paused), or draft",
                          "enum": [
                            "available",
                            "in_queue",
                            "draft"
                          ],
                          "example": "in_queue"
                        },
                        "queueDetails": {
                          "description": "Queue details (present when in_queue or draft)",
                          "nullable": true,
                          "example": {
                            "queueId": "67fc07c6d7657c9aee764762",
                            "prioritizeNewContent": false,
                            "enableFuturePosts": true
                          },
                          "allOf": [
                            {
                              "type": "object",
                              "properties": {
                                "queueId": {
                                  "type": "string",
                                  "description": "Queue ID",
                                  "example": "67fc07c6d7657c9aee764762"
                                },
                                "prioritizeNewContent": {
                                  "type": "boolean",
                                  "description": "Prioritize new content over older content",
                                  "example": false
                                },
                                "enableFuturePosts": {
                                  "type": "boolean",
                                  "description": "Enable posting future content",
                                  "example": true
                                }
                              },
                              "title": "AvailableCategoryQueueDetailsDTO"
                            }
                          ]
                        }
                      },
                      "title": "AvailableCategoryDTO"
                    }
                  },
                  "meta": {
                    "description": "Pagination metadata",
                    "example": {
                      "count": "100"
                    },
                    "allOf": [
                      {
                        "type": "object",
                        "properties": {
                          "count": {
                            "type": "string",
                            "example": "100",
                            "description": "Total count of items"
                          }
                        },
                        "title": "MetaDTO"
                      }
                    ]
                  }
                },
                "title": "FetchAvailableCategoriesResponseDTO"
              }
            ]
          },
          "traceId": {
            "type": "string",
            "description": "Trace ID for debugging",
            "example": "TRACE-abc123-def456"
          }
        },
        "required": [
          "success",
          "statusCode",
          "results"
        ],
        "title": "WrappedFetchAvailableCategoriesResponseDTO"
      },
      "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 GET 'https://services.leadconnectorhq.com/social-media-posting/category/queues/available-categories?locationId=<LOCATIONID>' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: v3'
```

**Node.js**

```javascript
const options = {
  method: 'GET',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: 'v3'
  }
};

try {
  const response = await fetch('https://services.leadconnectorhq.com/social-media-posting/category/queues/available-categories?locationId=<LOCATIONID>', 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/available-categories"

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

params = {
    "locationId": "<LOCATIONID>"
}

response = requests.get(url, params=params, 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/available-categories?locationId=<LOCATIONID>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: v3',
  ],
]);

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

**Java**

```java
HttpResponse<String> response = Unirest
  .get("https://services.leadconnectorhq.com/social-media-posting/category/queues/available-categories?locationId=<LOCATIONID>")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "v3")
  .asString();
```

**Go**

```go
package main

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

func main() {
  url := "https://services.leadconnectorhq.com/social-media-posting/category/queues/available-categories?locationId=<LOCATIONID>"
  req, _ := http.NewRequest("GET", url, nil)
  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/available-categories?locationId=<LOCATIONID>")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = "Bearer <TOKEN>"
request["Version"] = "v3"

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

**PowerShell**

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

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/social-media-posting/category/queues/available-categories?locationId=<LOCATIONID>' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
```
