User API

Documentation on using the user API through OAuth2 in SePay.


Introduction

SePay's User API allows you to access information about the current user and their company. You can get personal information of the user and detailed information about the company they belong to.

To use this API, you need the profile permission (for user information) or company permission (for company information) in the Access Token scope.


Get User Information

GET
https://my.sepay.vn/api/v1/me
Authorization: Bearer {YOUR_ACCESS_TOKEN}

This endpoint returns information of the current user authenticated via OAuth2.

Required permissions:

  • Scope: profile
>
>
curl -X GET "https://my.sepay.vn/api/v1/me" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
RESPONSE
{
    "status": "success",
    "data": {
        "id": 1234,
        "first_name": "Nguyễn",
        "last_name": "Văn A",
        "email": "nguyen.van.a@example.com",
        "phone": "0901234567",
        "avatar": "https://www.gravatar.com/avatar/0bc83cb571cd1c50ba6f3e8a78ef1346"
    }
}
idinteger

User ID

first_namestring

User's first name

last_namestring

User's last name

emailstring

User's email address

phonestring

User's phone number

avatarstring

Avatar URL from Gravatar


Error Codes

Below are the error codes that may be encountered when using the User API:

401unauthorized

Token is invalid or expired

403forbidden

No permission to access this resource


Next Step

Next, learn about the Company API to get detailed information about the user's company.