> 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.

# Get Matching Collections

GET https://api.staple.io/v1/matching/collections

Lists all matching collections in your organisation. Each collection includes its ID, the number of matched and unmatched documents, and the current version ID. Use this to discover the collection IDs required by the matching tuple endpoints.

Reference: https://docs.staple.ai/api-reference/v1/matching/get-matching-collections

## Authentication

- `x-api-key` header (required) — API key issued by Staple.
- `Authorization` header (bearer token, required) — JWT obtained from the login endpoint.

## Response

### 200

OK

## Examples

**Response**

```json
{
  "getMatchingCollections": [
    {
      "collectionQueues": null,
      "companyId": 1,
      "createdAt": 1611312132120,
      "currentVersionId": "dfb0c18a-cde9-4d62-bed4-594e86922472",
      "id": 3,
      "name": "Joshs sample Queue",
      "numMatchedDocs": 0,
      "numUnmatchedDocs": 1,
      "uid": 1,
      "updatedAt": 1713333098768
    },
    {
      "collectionQueues": null,
      "companyId": 1,
      "createdAt": 1611312132120,
      "currentVersionId": "dfb0c18a-cde9-4d62-bed4-594e86922472",
      "id": 4,
      "name": "Joshs sample Queue 2",
      "numMatchedDocs": 0,
      "numUnmatchedDocs": 1,
      "uid": 1,
      "updatedAt": 1713333098768
    }
  ]
}
```

**SDK Code**

```python Get Matching Collections
import requests

url = "https://api.staple.io/v1/matching/collections"

headers = {"x-api-key": "<apiKey>"}

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

print(response.json())
```

```javascript Get Matching Collections
const url = 'https://api.staple.io/v1/matching/collections';
const options = {method: 'GET', headers: {'x-api-key': '<apiKey>'}};

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

```go Get Matching Collections
package main

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

func main() {

	url := "https://api.staple.io/v1/matching/collections"

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

	req.Header.Add("x-api-key", "<apiKey>")

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

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

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

}
```

```ruby Get Matching Collections
require 'uri'
require 'net/http'

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

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

request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<apiKey>'

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

```java Get Matching Collections
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.staple.io/v1/matching/collections")
  .header("x-api-key", "<apiKey>")
  .asString();
```

```php Get Matching Collections
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.staple.io/v1/matching/collections', [
  'headers' => [
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Get Matching Collections
using RestSharp;

var client = new RestClient("https://api.staple.io/v1/matching/collections");
var request = new RestRequest(Method.GET);
request.AddHeader("x-api-key", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift Get Matching Collections
import Foundation

let headers = ["x-api-key": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.staple.io/v1/matching/collections")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
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()
```