How to create and use the API token: the values you receive from MyRent, the token flow and token lifetime.
The Auth API creates the short-lived token that the account-based MyRent APIs (User API, Messages, Customer API, Registars) need in the token header.
Before you start
MyRent enables API access for the account and gives you, together with a ready cURL command:
| Value | Use |
|---|---|
| API key | Authorization header of the Auth API (without Bearer). |
user_guid | user_guid header of the Auth API and of all later calls. |
user_id | Body of Generate token. |
public_key, auth_key | Body of Generate token. |
Flow
- Call Generate token with the values above. The response is
{ "token": "..." }. - Send
user_guidandtokenas headers in every API call that needs them. - The token is valid for 1 hour. Cache it and create a new one about every 45 minutes. Do not create a token for every request.
- Optionally check a token with Validate token.
Wrong or missing Auth API headers return 404 with an empty body; wrong keys return 403.
Keep credentials private
Keep the API key,
public_keyandauth_keyon your server. Never put them into browser or mobile app code, and never log them.
