> For the complete documentation index, see [llms.txt](https://docs.id.gov.sg/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.id.gov.sg/integrations-with-sgid/api-documentation.md).

# API Documentation

The API endpoints listed here are for reference purposes only. sgID users are strongly recommended to use the SDK(s) provided which sends these requests for you.

If there are no SDKs provided for your programming language, please refer to [Custom Integration](/integrations-with-sgid/custom-integration.md) on how to set up your own integration.

## Endpoints

{% hint style="danger" %}
**Do not reuse the example code challenge and code verifier provided in the API examples**, as this would expose your API requests to PKCE guessing attacks by malicious users. Refer to the example code under the [SDKs section](/integrations-with-sgid/typescript-javascript.md) on how to generate valid `<code_verifier, code_challenge>` pairs.
{% endhint %}

{% openapi src="/files/TiLKj6vwQvKur3SMjuU9" path="/v2/oauth/authorize" method="get" %}
[openapi.yaml](https://2214909052-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBW92htBuXTrDYoKovQ2%2Fuploads%2Fm4QxYNN4G7ohsReTJGlB%2Fopenapi.yaml?alt=media\&token=180d598a-142c-42f2-b72b-20c55cc0bcae)
{% endopenapi %}

{% openapi src="/files/TiLKj6vwQvKur3SMjuU9" path="/v2/oauth/token" method="post" %}
[openapi.yaml](https://2214909052-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBW92htBuXTrDYoKovQ2%2Fuploads%2Fm4QxYNN4G7ohsReTJGlB%2Fopenapi.yaml?alt=media\&token=180d598a-142c-42f2-b72b-20c55cc0bcae)
{% endopenapi %}

{% openapi src="/files/TiLKj6vwQvKur3SMjuU9" path="/v2/oauth/userinfo" method="get" %}
[openapi.yaml](https://2214909052-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBW92htBuXTrDYoKovQ2%2Fuploads%2Fm4QxYNN4G7ohsReTJGlB%2Fopenapi.yaml?alt=media\&token=180d598a-142c-42f2-b72b-20c55cc0bcae)
{% endopenapi %}

{% openapi src="/files/TiLKj6vwQvKur3SMjuU9" path="/v2/.well-known/jwks.json" method="get" %}
[openapi.yaml](https://2214909052-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBW92htBuXTrDYoKovQ2%2Fuploads%2Fm4QxYNN4G7ohsReTJGlB%2Fopenapi.yaml?alt=media\&token=180d598a-142c-42f2-b72b-20c55cc0bcae)
{% endopenapi %}

{% openapi src="/files/TiLKj6vwQvKur3SMjuU9" path="/v2/.well-known/openid-configuration" method="get" %}
[openapi.yaml](https://2214909052-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBW92htBuXTrDYoKovQ2%2Fuploads%2Fm4QxYNN4G7ohsReTJGlB%2Fopenapi.yaml?alt=media\&token=180d598a-142c-42f2-b72b-20c55cc0bcae)
{% endopenapi %}


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.id.gov.sg/integrations-with-sgid/api-documentation.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
