> For the complete documentation index, see [llms.txt](https://docs.flowretail.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flowretail.com/docs/developers/api-documentation/user/generate-an-access-token-or-refresh-an-unlock-token-issued-by-verify-pin.md). Agents can also search and read this documentation through its [MCP server](https://docs.flowretail.com/docs/~gitbook/mcp).

# Generate an access token, or refresh an unlock token issued by verify-pin

Generate an access token for the logged-in user, or refresh an unlock token issued by the tenant user verify-pin operation. Both answer AccountLoginResponse: the token, and the user it was issued for. Under an auth token it mints an access token for the logged-in user. Under an access token it is the refresh for an unlock token issued by post-tenants-users-verifypin. It answers a fresh unlock token for the same user, with the platform's access-token lifetime counted from the refresh, carrying the same claims as the unlock token it refreshes: the screen account, carried as it stands, and the original unlock time, which never moves. A screen account deleted since the unlock stays in the unlock token; every write under that unlock token records no screen account, as the event's screenAccountTenantUserUid describes. The refresh is refused with a 401 once that unlock is older than 12 hours, and the person then unlocks again with their PIN. The refresh reads the user again and is refused with a 401 when their PIN is locked (pinLocked), so a user locked mid-shift keeps the unlock token they hold only until it expires. A user who can no longer log in is refused before the refresh is judged, with the 403 the platform answers on every operation to a user without access to the tenant: a user deactivated mid-shift loses the unlock token on their next request, here and everywhere else. The refresh does not read the screen account again: deactivating it or locking its PIN ends no unlock token already issued through it. Any other access token — one that carries no unlock time, such as a device login's from post-account — is refused with a 401: this operation never extends a token that is not an unlock token.

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"User","description":"User"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"}},"responses":{"AccountLoginResponse":{"content":{"application/json":{"schema":{"properties":{"accessToken":{"type":"string"},"tenantUser":{"$ref":"#/components/schemas/TenantUserResponseSchema"}},"required":["accessToken","tenantUser"],"type":"object"}}},"description":"Example response"}},"schemas":{"TenantUserResponseSchema":{"title":"TenantUserResponseSchema","type":"object","required":["accountType","createdAt","displayName","email","externalId","firstname","lastAccessed","lastModifiedAt","lastname","mobile","pinLocked","pinLockedUntil","status","storeAccess","tenantUid","tenantName","tenantRole","tenantUserUid","userCode","languageCode","permissions"],"properties":{"accountType":{"$ref":"#/components/schemas/TenantAccountTypeENUM"},"createdAt":{"format":"date-time","type":"string"},"defaultStoreUid":{"$ref":"#/components/schemas/OptionalUID"},"displayName":{"type":"string"},"email":{"$ref":"#/components/schemas/EmailTYPE"},"externalId":{"type":"string"},"firstname":{"type":"string"},"lastAccessed":{"format":"date-time","type":"string"},"lastModifiedAt":{"format":"date-time","type":"string"},"lastname":{"type":"string"},"mobile":{"type":"string"},"pinLocked":{"type":"boolean","description":"The user's PIN is locked after repeated failures, until someone holding TENANT_USER gives the user a new PIN through the tenant user update. While it is set no PIN of theirs is accepted — not by the tenant user verify-pin operation, the secret reveal, the cash reconciliation review, the device login or the device link — and no unlock token of theirs is refreshed. The ladder that leads here is described on the verify-pin operation."},"pinLockedUntil":{"type":"string","format":"date-time","nullable":true,"description":"When the running wait on the user's PIN ends, after repeated failures; until then every PIN attempt against the user is refused. null when no wait is running. A locked user reads null here and pinLocked true."},"status":{"$ref":"#/components/schemas/TenantUserStatusENUM"},"storeAccess":{"type":"array","items":{"$ref":"#/components/schemas/UserStoreAccessResponseSchema"}},"tenantUid":{"$ref":"#/components/schemas/UID"},"tenantName":{"type":"string"},"tenantRole":{"$ref":"#/components/schemas/TenantRoleENUM"},"tenantUserUid":{"$ref":"#/components/schemas/UID"},"userCode":{"type":"string"},"languageCode":{"$ref":"#/components/schemas/LanguageCode"},"permissions":{"$ref":"#/components/schemas/TenantUserPermissionResponseSchema"}},"description":""},"TenantAccountTypeENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| FULL | Access to backoffice and onboarding of new devices|\n| REGULAR | Can only login to already onboarded devices|\n| SUPPORT | Support account|\n| INTEGRATION | Computer integration account|","enum":["FULL","REGULAR","SUPPORT","INTEGRATION"],"title":"TenantAccountTypeENUM","type":"string"},"OptionalUID":{"title":"OptionalUID","type":"string","pattern":"^[A-Za-z0-9-_]*"},"EmailTYPE":{"title":"Email","type":"string"},"TenantUserStatusENUM":{"title":"TenantUserStatusENUM","enum":["PENDING_INVITE","ACTIVE","INACTIVE"],"type":"string"},"UserStoreAccessResponseSchema":{"title":"UserStoreAccessResponseSchema","type":"object","required":["createdAt","lastModifiedAt","storeAccessUid","storeUid","storeRole"],"properties":{"createdAt":{"format":"date-time","type":"string"},"lastModifiedAt":{"format":"date-time","type":"string"},"storeAccessUid":{"$ref":"#/components/schemas/UID"},"storeUid":{"$ref":"#/components/schemas/UID"},"storeRole":{"$ref":"#/components/schemas/StoreRoleENUM"}}},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"StoreRoleENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| ADMIN | Store admin.|\n| BACKOFFICE | Access to all backoffice functionality (price changes, purhcase order, etc)|\n| REGULAR | Access to app funtionality (product lookup, create sales, delivery)|","enum":["ADMIN","BACKOFFICE","REGULAR"],"title":"StoreRoleENUM","type":"string"},"TenantRoleENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| BLOCKED | Blocked from this tenant|\n| ACCESS | Only access to the tenant.|\n| ADMIN | Tenant admin, allow full access to tenant and can add users and new stores.|\n| BACKOFFICE | Access to product, pricelists, etc.|","enum":["ACCESS","ADMIN","BACKOFFICE","BLOCKED"],"title":"TenantRoleENUM","type":"string"},"LanguageCode":{"title":"LanguageCode","description":"Lowercase two-letter ISO 639-1 language code, like nb, en or sv.","type":"string"},"TenantUserPermissionResponseSchema":{"title":"TenantUserPermissionResponseSchema","type":"object","required":["tenant","stores","organizations"],"properties":{"tenant":{"type":"array","items":{"type":"string"}},"stores":{"type":"array","items":{"$ref":"#/components/schemas/StorePermissionResponseSchema"}},"organizations":{"type":"array","items":{"$ref":"#/components/schemas/OrganizationPermissionResponseSchema"}}}},"StorePermissionResponseSchema":{"title":"StorePermissionResponseSchema","type":"object","required":["store","permissions"],"properties":{"store":{"$ref":"#/components/schemas/BasicStoreResponseSchema"},"permissions":{"type":"array","items":{"type":"string"}}}},"BasicStoreResponseSchema":{"title":"BasicStoreResponseSchema","type":"object","required":["name","storeUid","organizationUid","organizationName"],"properties":{"name":{"type":"string"},"storeUid":{"$ref":"#/components/schemas/UID"},"organizationUid":{"$ref":"#/components/schemas/UID"},"organizationName":{"type":"string"}}},"OrganizationPermissionResponseSchema":{"title":"OrganizationPermissionResponseSchema","type":"object","required":["organization","permissions"],"properties":{"organization":{"$ref":"#/components/schemas/BasicOrganizationResponseSchema"},"permissions":{"type":"array","items":{"type":"string"}}}},"BasicOrganizationResponseSchema":{"title":"BasicOrganizationResponseSchema","type":"object","required":["name","organizationUid"],"properties":{"name":{"type":"string"},"organizationUid":{"$ref":"#/components/schemas/UID"}}}}},"paths":{"/tenants/{tenantUid}/account":{"post":{"summary":"Generate an access token, or refresh an unlock token issued by verify-pin","operationId":"post-tenants-account","responses":{"200":{"$ref":"#/components/responses/AccountLoginResponse"},"401":{"description":"The token cannot be refreshed: the unlock is older than 12 hours, the user's PIN is locked, or the token is not an unlock token: an access token that carries no unlock time, or an integration token."}},"description":"Generate an access token for the logged-in user, or refresh an unlock token issued by the tenant user verify-pin operation. Both answer AccountLoginResponse: the token, and the user it was issued for.\nUnder an auth token it mints an access token for the logged-in user.\nUnder an access token it is the refresh for an unlock token issued by post-tenants-users-verifypin. It answers a fresh unlock token for the same user, with the platform's access-token lifetime counted from the refresh, carrying the same claims as the unlock token it refreshes: the screen account, carried as it stands, and the original unlock time, which never moves. A screen account deleted since the unlock stays in the unlock token; every write under that unlock token records no screen account, as the event's screenAccountTenantUserUid describes. The refresh is refused with a 401 once that unlock is older than 12 hours, and the person then unlocks again with their PIN. The refresh reads the user again and is refused with a 401 when their PIN is locked (pinLocked), so a user locked mid-shift keeps the unlock token they hold only until it expires. A user who can no longer log in is refused before the refresh is judged, with the 403 the platform answers on every operation to a user without access to the tenant: a user deactivated mid-shift loses the unlock token on their next request, here and everywhere else. The refresh does not read the screen account again: deactivating it or locking its PIN ends no unlock token already issued through it. Any other access token — one that carries no unlock time, such as a device login's from post-account — is refused with a 401: this operation never extends a token that is not an unlock token.","tags":["User"]}}}}
```


---

# 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.flowretail.com/docs/developers/api-documentation/user/generate-an-access-token-or-refresh-an-unlock-token-issued-by-verify-pin.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.
