Skip to main content
Skip table of contents

Generate PIN

1. Introduction

With MyQ REST API, you can generate a new pin for a user that can then be used to log into your custom application or MyQ system. This is usually done when user is registering into the system and need an pin code to access his/her account. This endpoint can also be used with the “Forgot password?“ feature.

2. Prerequisites

REST API application in MyQ → Settings → External Systems has to have access to scope called Users.

3. Calling the API

The endpoint we will in this guide is defined as:

CODE
Endpoint:
POST /v2/users/{id}/pins

Authentication:
Grant_type: client_credentials
Scopes: [ users ]

Headers:
Content-Type: application/json
Authentication: Bearer %access_token%

Body: 
{
	"deleteOld": boolean
}

Note that the %access_token% needs to be replaced by the token you received as a response from auth endpoint.

From the definition, we can see that the definition includes one optional parameter deleteOld in the body and one required parameter in the endpoint path called {id}.

This is the id of a MyQ user. This id can be requested in multiple ways from the MyQ server. We will show how to do this in the guide Searching for a user id.

deleteOld parameter determents if old pins should be deleted. Users in MyQ can have multiple pin codes. Setting this parameter to true (by default false) deletes the old pin codes.

4. Response

CODE
Code:
2xx

Response:
{
	"pin": string
}

If the endpoint was called correctly with correct parameters. The response code should be 2xx and the body should include a JSON with the newly generated pin.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.