> For the complete documentation index, see [llms.txt](https://docs.mdintegrations.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mdintegrations.com/partner-api-reference/partner/general/authorize-a-client-to-access-the-users-account.md).

# Authorize a client to access the user's account

Issues an OAuth2 client-credentials access token for the partner's client\_id and client\_secret, which may be sent in the request body or as an Authorization: Basic header. A previously issued, unexpired token is cached and reused instead of requesting a new one on every call.

```json
{"openapi":"3.1.0","info":{"title":"MD Integrations","version":"1.0.0"},"tags":[{"name":"Partner/General"}],"servers":[{"url":"https://api.mdintegrations.dev/v1","description":"Development"}],"security":[{}],"paths":{"/partner/auth/token":{"post":{"operationId":"v1.partner.auth.token.post","description":"Issues an OAuth2 client-credentials access token for the partner's client_id and\nclient_secret, which may be sent in the request body or as an Authorization: Basic\nheader. A previously issued, unexpired token is cached and reused instead of requesting\na new one on every call.","summary":"Authorize a client to access the user's account","tags":["Partner/General"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostPartnerAuthRequest"}}}},"responses":{"200":{"description":"Returns the decoded issued token;","content":{"application/json":{"schema":{"type":"string"}}}},"401":{"$ref":"#/components/responses/AuthenticationException"},"422":{"$ref":"#/components/responses/ValidationException"}}}}},"components":{"schemas":{"PostPartnerAuthRequest":{"type":"object","properties":{"client_id":{"type":["string","null"],"format":"uuid","description":"Nullable, not required: a client may instead send these as an\n`Authorization: Basic base64(client_id:client_secret)` header, the OAuth2\nRFC's other standard transport - AuthController::resolveClientCredentials()\nfalls back to it, and league/oauth2-server (via Passport) already validates\nwhichever transport is actually used regardless of this exists() check;"},"client_secret":{"type":["string","null"]},"grant_type":{"type":"string","enum":["client_credentials"]},"scope":{"type":"string"}},"required":["grant_type","scope"],"title":"PostPartnerAuthRequest"}},"responses":{"AuthenticationException":{"description":"Unauthenticated","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"Error overview."}},"required":["message"]}}}},"ValidationException":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"Errors overview."},"errors":{"type":"object","description":"A detailed description of each field that failed validation.","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["message","errors"]}}}}}}}
```


---

# 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.mdintegrations.com/partner-api-reference/partner/general/authorize-a-client-to-access-the-users-account.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.
