> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.staple.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.staple.ai/_mcp/server.

# Create Queue

POST https://api.staple.io/v1/queues
Content-Type: application/json

Create a new queue by stating the new queues name, group id, language and other relevant information

Reference: https://docs.staple.ai/api-reference/v1/queues/create-queue

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: v1
  version: 1.0.0
paths:
  /v1/queues:
    post:
      operationId: createQueue
      summary: Create Queue
      description: >-
        Create a new queue by stating the new queues name, group id, language
        and other relevant information
      tags:
        - queues
      parameters:
        - name: x-api-key
          in: header
          description: API key issued by Staple.
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Queues_createQueue_Response_200'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                input:
                  $ref: >-
                    #/components/schemas/V1QueuesPostRequestBodyContentApplicationJsonSchemaInput
                members:
                  type: array
                  items:
                    type: string
servers:
  - url: https://api.staple.io
    description: https://api.staple.io
components:
  schemas:
    V1QueuesPostRequestBodyContentApplicationJsonSchemaInput:
      type: object
      properties:
        gid:
          type: integer
        name:
          type: string
        accountType:
          type: string
        supplier:
          type: string
        customer:
          type: string
        docType:
          type: string
        language:
          type: string
      title: V1QueuesPostRequestBodyContentApplicationJsonSchemaInput
    Queues_createQueue_Response_200:
      type: object
      properties: {}
      description: Empty response body
      title: Queues_createQueue_Response_200
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: API key issued by Staple.
    bearerAuth:
      type: http
      scheme: bearer
      description: JWT obtained from the login endpoint.

```

## Examples

### Create Queue



**Request**

```json
undefined
```

**Response**

```json
{
  "createQueue": {
    "accountType": "TEST",
    "createdAt": 1593771586688,
    "customer": "TEST",
    "docType": "INVOICE",
    "documentCount": 0,
    "gid": 11,
    "id": 1,
    "language": "EN",
    "name": "New queue",
    "supplier": "TEST",
    "tags": null,
    "uid": 40
  }
}
```

**SDK Code**

```python Create Queue
import requests

url = "https://api.staple.io/v1/queues"

headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript Create Queue
const url = 'https://api.staple.io/v1/queues';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: undefined
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Create Queue
package main

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

func main() {

	url := "https://api.staple.io/v1/queues"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

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

url = URI("https://api.staple.io/v1/queues")

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

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'

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

```java Create Queue
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.staple.io/v1/queues")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .asString();
```

```php Create Queue
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.staple.io/v1/queues', [
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Create Queue
using RestSharp;

var client = new RestClient("https://api.staple.io/v1/queues");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
```

```swift Create Queue
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.staple.io/v1/queues")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Queues_createQueue_example



**Request**

```json
{
  "input": {
    "gid": 1,
    "name": "New queue",
    "accountType": "TEST",
    "supplier": "TEST",
    "customer": "TEST",
    "docType": "INVOICE",
    "language": "EN"
  },
  "members": [
    "member1@gmail.com"
  ]
}
```

**Response**

```json
{
  "createQueue": {
    "accountType": "TEST",
    "createdAt": 1593771586688,
    "customer": "TEST",
    "docType": "INVOICE",
    "documentCount": 0,
    "gid": 11,
    "id": 1,
    "language": "EN",
    "name": "New queue",
    "supplier": "TEST",
    "tags": null,
    "uid": 40
  }
}
```

**SDK Code**

```python Queues_createQueue_example
import requests

url = "https://api.staple.io/v1/queues"

payload = {
    "input": {
        "gid": 1,
        "name": "New queue",
        "accountType": "TEST",
        "supplier": "TEST",
        "customer": "TEST",
        "docType": "INVOICE",
        "language": "EN"
    },
    "members": ["member1@gmail.com"]
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Queues_createQueue_example
const url = 'https://api.staple.io/v1/queues';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"input":{"gid":1,"name":"New queue","accountType":"TEST","supplier":"TEST","customer":"TEST","docType":"INVOICE","language":"EN"},"members":["member1@gmail.com"]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Queues_createQueue_example
package main

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

func main() {

	url := "https://api.staple.io/v1/queues"

	payload := strings.NewReader("{\n  \"input\": {\n    \"gid\": 1,\n    \"name\": \"New queue\",\n    \"accountType\": \"TEST\",\n    \"supplier\": \"TEST\",\n    \"customer\": \"TEST\",\n    \"docType\": \"INVOICE\",\n    \"language\": \"EN\"\n  },\n  \"members\": [\n    \"member1@gmail.com\"\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

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

url = URI("https://api.staple.io/v1/queues")

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

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"input\": {\n    \"gid\": 1,\n    \"name\": \"New queue\",\n    \"accountType\": \"TEST\",\n    \"supplier\": \"TEST\",\n    \"customer\": \"TEST\",\n    \"docType\": \"INVOICE\",\n    \"language\": \"EN\"\n  },\n  \"members\": [\n    \"member1@gmail.com\"\n  ]\n}"

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

```java Queues_createQueue_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.staple.io/v1/queues")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"input\": {\n    \"gid\": 1,\n    \"name\": \"New queue\",\n    \"accountType\": \"TEST\",\n    \"supplier\": \"TEST\",\n    \"customer\": \"TEST\",\n    \"docType\": \"INVOICE\",\n    \"language\": \"EN\"\n  },\n  \"members\": [\n    \"member1@gmail.com\"\n  ]\n}")
  .asString();
```

```php Queues_createQueue_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.staple.io/v1/queues', [
  'body' => '{
  "input": {
    "gid": 1,
    "name": "New queue",
    "accountType": "TEST",
    "supplier": "TEST",
    "customer": "TEST",
    "docType": "INVOICE",
    "language": "EN"
  },
  "members": [
    "member1@gmail.com"
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Queues_createQueue_example
using RestSharp;

var client = new RestClient("https://api.staple.io/v1/queues");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"input\": {\n    \"gid\": 1,\n    \"name\": \"New queue\",\n    \"accountType\": \"TEST\",\n    \"supplier\": \"TEST\",\n    \"customer\": \"TEST\",\n    \"docType\": \"INVOICE\",\n    \"language\": \"EN\"\n  },\n  \"members\": [\n    \"member1@gmail.com\"\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Queues_createQueue_example
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "input": [
    "gid": 1,
    "name": "New queue",
    "accountType": "TEST",
    "supplier": "TEST",
    "customer": "TEST",
    "docType": "INVOICE",
    "language": "EN"
  ],
  "members": ["member1@gmail.com"]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.staple.io/v1/queues")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```