> For the complete documentation index, see [llms.txt](https://guide.data.gov.sg/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://guide.data.gov.sg/developer-guide/collection-apis.md).

# Collection APIs

### Collections listing

This API returns a list of all the collections on data.gov.sg

## GET /v2/public/api/collections

> Get collections

```json
{"openapi":"3.0.3","info":{"title":"beta.data.gov.sg Public API","version":"1.0.11"},"tags":[{"name":"collections"}],"servers":[{"url":"https://api-production.data.gov.sg"}],"paths":{"/v2/public/api/collections":{"get":{"summary":"Get collections","tags":["collections"],"parameters":[{"in":"query","name":"page","schema":{"type":"integer","minimum":1},"description":"Page number (optional, must be 1 or more)"}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer"},"data":{"type":"object","properties":{"collections":{"type":"array","items":{"type":"object","properties":{"collectionId":{"type":"string"},"createdAt":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"lastUpdatedAt":{"type":"string"},"coverageStart":{"type":"string"},"coverageEnd":{"type":"string"},"frequency":{"type":"string"},"sources":{"type":"array","items":{"type":"string"}},"managedByAgencyName":{"type":"string"},"childDatasets":{"type":"array","items":{"type":"string"}}}}},"pages":{"type":"integer"}}},"errorMsg":{"type":"string"}}}}}}}}}}}
```

### Collection metadata

This API returns the metadata of a single collection and the datasets within it

## GET /v2/public/api/collections/{collectionId}/metadata?withDatasetMetadata=true

> Get metadata for a collection

```json
{"openapi":"3.0.3","info":{"title":"beta.data.gov.sg Public API","version":"1.0.11"},"tags":[{"name":"collections"}],"servers":[{"url":"https://api-production.data.gov.sg"}],"paths":{"/v2/public/api/collections/{collectionId}/metadata?withDatasetMetadata=true":{"get":{"summary":"Get metadata for a collection","tags":["collections"],"parameters":[{"in":"path","name":"collectionId","required":true,"schema":{"type":"number"},"description":"The unique identifier of the collection (number)"},{"in":"query","name":"withDatasetMetadata","schema":{"type":"boolean"},"description":"Include dataset metadata (true or false, default is false)"}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer"},"data":{"type":"object","properties":{"collectionMetadata":{"type":"object","properties":{"collectionId":{"type":"string"},"createdAt":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"lastUpdatedAt":{"type":"string"},"coverageStart":{"type":"string"},"coverageEnd":{"type":"string"},"frequency":{"type":"string"},"sources":{"type":"array","items":{"type":"string"}},"managedBy":{"type":"string"},"childDatasets":{"type":"array","items":{"type":"string"}}}},"datasetMetadata":{"type":"array","items":{"type":"object","properties":{"datasetId":{"type":"string"},"createdAt":{"type":"string"},"name":{"type":"string"},"format":{"type":"string"},"lastUpdatedAt":{"type":"string"},"managedBy":{"type":"string"},"coverageStart":{"type":"string"},"coverageEnd":{"type":"string"}}}}}},"errorMsg":{"type":"string"}}}}}}}}}}}
```

{% hint style="info" %}
To find the collectionId, refer to the URL of collection.\
\
For this collection:\
<https://beta.data.gov.sg/collections/522/view>\
\
The collectionId is:\
`522`
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://guide.data.gov.sg/developer-guide/collection-apis.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
