> For the complete documentation index, see [llms.txt](https://constanza-gobbo.gitbook.io/technical-documentation-portfolio/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://constanza-gobbo.gitbook.io/technical-documentation-portfolio/medisync-api/authentication.md).

# Authentication

1. #### Create an account:

Go to the MediSync Developer Portal to register your application. You will receive a `client_id` and `client_secret`. You will need these for the next step.

2. #### Request a token:

MediSync uses OAuth 2.0 client credentials.

Use `POST /oauth/token` with your `client_id` and `client_secret` to obtain a bearer token. The request body must include a scope, which details the access levels for your application. For the purposes of this tutorial, the necessary scopes are `records:read`, `appointments:read`, `appointments:write`. You can see a detailed account of all different access levels in the *Scopes* section.

```
curl --location https://auth.medisync.io/oauth/token \
--header 'Content-Type: application/json' \
--data '{  
  "grant_type": "client_credentials",
  "client_id": "your_client_id",
  "client_secret": "your_client_secret",
  "scope": "records:read appointments:read appointments:write"
}'
```

Response:

```json
{
  "access_token": "eyJhbGci...",
  "token_type": "bearer",
  "expires_in": 3600,
  "scope": "records:read appointments:read appointments:write"
}
```

Do not log or expose the access token client-side. Tokens are valid for one hour.


---

# 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://constanza-gobbo.gitbook.io/technical-documentation-portfolio/medisync-api/authentication.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.
