> For the complete documentation index, see [llms.txt](https://docs.thryve.health/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.thryve.health/further-resources/v5-api-reference/create-or-get-user.md).

# Create or get user

## Get accessToken of new or existing user

> Retrieve an accessToken for a Thryve user. Automatically creates a user if partnerUserID is empty or no existing user with specified partnerUserID exists.<br>

```json
{"openapi":"3.1.0","info":{"title":"Thryve API","version":"5.0.0"},"servers":[{"url":"https://api.thryve.de"}],"paths":{"/v5/accessToken":{"post":{"summary":"Get accessToken of new or existing user","tags":["End User"],"description":"Retrieve an accessToken for a Thryve user. Automatically creates a user if partnerUserID is empty or no existing user with specified partnerUserID exists.\n","parameters":[{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"},"description":"Basic Auth for your username:password. Required for all endpoints"},{"name":"AppAuthorization","in":"header","required":true,"schema":{"type":"string"},"description":"Basic Auth for your authID:authSecret. Required for all endpoints."}],"requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/AccessTokenRequest"}}}},"responses":{"200":{"description":"Request successful. Returns the accessToken of a user.","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/AccessTokenResponse"}}}},"400":{"description":"Error response (invalid parameters, unauthorized, etc.).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"AccessTokenRequest":{"type":"object","properties":{"partnerUserID":{"type":"string","description":"Set this optional parameter to add your an alias to a Thryve user. If no alias is set, it is not possible to retrieve an accessToken/authenticationToken for an existing user. Newer interfaces call this parameter endUserAlias."}}},"AccessTokenResponse":{"type":"string"},"ErrorResponse":{"type":"string"}}}}
```


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.thryve.health/further-resources/v5-api-reference/create-or-get-user.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
