Users

Users represent peoples that have account in the Account project. A User is a main person that use all the feature of the account ecosystem. a user have profile for details and personal information about user and related account specifics. a user have recovery methods for account and user recovery information. On this page, we’ll explore how to query, create, update, and delete Users.

The User model

Each user have profile and recovery methods required for your app to store details about the user and create methods for account and user recovery.

Properties

  • Name
    id
    Type
    string
    Description

    Raha Accounts’s unique identifier for the user (internal).

  • Name
    email
    Type
    email | null
    Description

    Unique Public identifier for email use in CRUD and find user.

  • Name
    phone_number
    Type
    string | null
    Description

    Unique Public identifier for phone number use in CRUD and find user.

  • Name
    username
    Type
    string | null
    Description

    Unique Public identifier for username, use in CRUD and find user.

  • Name
    status
    Type
    string[]
    Description

    ACTIVE | LOCKED | SUSPENDED.

  • Name
    created_at
    Type
    timestamp
    Description

    Time the user was created.

  • Name
    updated_at
    Type
    timestamp
    Description

    Time the user was last updated.

  • Name
    email_verified_at
    Type
    timestamp
    Description

    Time the user email was verified.

  • Name
    phone_number_verified_at
    Type
    timestamp
    Description

    Time the user phone number was verified.

  • Name
    recovery_methods
    Type
    string[]
    Description

    Recovery methods for the user info and account.

  • Name
    default_profile
    Type
    string
    Description

    Default profile id for user.

  • Name
    profiles
    Type
    Profile[]
    Description

    Profiles for the user details.


GET/v1/admin/users

List all users

Retrieve a paginated list of users that you manage.

Optional attributes

  • Name
    pagination[per_page]
    Type
    integer
    Description

    Max number of clients per page (default 10).

  • Name
    pagination[page]
    Type
    integer
    Description

    Page number to return (default 1).

  • Name
    filter[username]
    Type
    string
    Description

    Filter by user username.

  • Name
    filter[phone_number]
    Type
    string
    Description

    Filter by user phone number.

  • Name
    filter[email]
    Type
    string
    Description

    Filter by user email.

  • Name
    order[id]
    Type
    string
    Description

    ASC | DESC. Sort by user Identifier (userId).

  • Name
    order[username]
    Type
    string
    Description

    Sort by user username.

  • Name
    order[phone_number]
    Type
    string
    Description

    Sort by user phone number.

  • Name
    order[email]
    Type
    string
    Description

    Sort by user email.

  • Name
    order[created_at]
    Type
    string
    Description

    ASC | DESC. Sort by creation time.

Request

GET
/v1/admin/users
curl -G https://api.account.raha.af/v1/admin/users \
-H "Authorization: Bearer {token}" \
-d per_page=10 \
-d page=1

Response

{
  "data": [
      {
        "id": "6adf52e2-a00b-4de4-a7e8-cc68a31fa34c",
        "status": "ACTIVE",
        "profile": {
            "id": "554aac12-e235-4efb-9526-180ffd53086e",
            "first_name": "Mohammad Hojjat jan",
            "last_name": "mahdizada",
            "avatar_path": "new img"
        },
        "created_at": {
            "seconds": "1758428193",
            "nanos": 748000000
        },
        "updated_at": {
            "seconds": "1758428193",
            "nanos": 748000000
        },
        "email": "mohammadhojjat2024@gmail.com",
        "phone_number": "+93792978455",
        "username": "mhm-new-version"
      }
  ],
  "meta": {
    "page": 1,
    "from": 1,
    "to": 10,
    "last_page": 25,
    "per_page": 10,
    "total": 249
  }
}

GET/v1/admin/users/:id

Get a user

Retrieve details of a specific User by its unique ID.

URL parameters

  • Name
    id
    Type
    string
    Description

    The unique identifier of the user to retrieve.

Request

GET
/v1/admin/users/:id
curl -G https://api.account.raha.af/v1/admin/:id \
-H "Authorization: Bearer {token}"

Response

  {
"id": "6adf52e2-a00b-4de4-a7e8-cc68a31fa34c",
"email": "mohammadhojjat2024@gmail.com",
"phone_number": "+93792978455",
"username": "mhm-new-version",
"status": "ACTIVE",
"profile": {
  "id": "554aac12-e235-4efb-9526-180ffd53086e",
  "first_name": "Mohammad Hojjat jan",
  "last_name": "mahdizada",
  "avatar_path": "new img"
},
"created_at": "2025-09-21T04:16:33.748Z",
"updated_at": "2025-09-21T04:16:33.748Z"
}

POST/v1/admin/users/

Create a user

Register a new User.

  • Name
    profile
    Type
    DefaultProfile object
    Description

    User Profile details.

  • Name
    first_name
    Type
    string
    Description

    User first name.

  • Name
    last_name
    Type
    string | null
    Description

    User last name.

  • Name
    avatar_path
    Type
    string | null
    Description

    User avatar image pathname.

  • Name
    email
    Type
    string | null
    Description

    User unique email.

  • Name
    phone_number
    Type
    string | null
    Description

    User unique phone number.

  • Name
    username
    Type
    string | null
    Description

    User unique username.

Request

POST
/v1/admin/users
curl -X POST https://api.account.raha.af/v1/admin/users \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{
  "profile": {
  "first_name": "Mohammad",
  "last_name": "Ahmadi",
  "avatar_path": "path/to/avatar.jpg"
  },
  "email": "raha@gmail.com",
  "phone_number": "+93792978455",
  "username": "amadi",
}'
 

Response

{
  "id": "7fa14506-cd83-442d-b02a-d001983753fa",
  "email": "raha@gmail.com",
  "phone_number": "+93792978455",
  "username": "amadi",
  "status": "ACTIVE",
  "profile": {
    "id": "56897aa9-abe8-450a-b229-b20590ac9c72",
    "first_name": "Mohammad",
    "last_name": "Ahmadi",
    "avatar_path": "path/to/avatar.jpg"
  },
  "created_at": "2025-10-04T05:21:00.113Z",
  "updated_at": "2025-10-04T05:21:00.113Z"
}

PUT/v1/admin/users/{id}

Update a user

Modify an existing user data.

URL parameters

  • Name
    id
    Type
    string
    Description

    The unique identifier of the client to update.

Updatable attributes

  • Name
    email
    Type
    string | null
    Description

    User new Email.

  • Name
    phone_number
    Type
    string | null
    Description

    User new Phone Number.

  • Name
    username
    Type
    string | null
    Description

    User new Username.

Request

PUT
/v1/admin/users/{id}
curl -X PUT https://api.account.raha.af/v1/admin/users/{id} \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{
  "email": "raha@gmail.com",
  "phone_number": "+93794456544",
  "username": "ahmadi",
}'

Response

Empty

DELETE/v1/admin/users/{id}

Delete a user

Remove a user. This action is irreversible.

URL parameters

  • Name
    id
    Type
    string
    Description

    The unique identifier of the user to delete.

Request

DELETE
/v1/admin/users/{id}
curl -X DELETE https://api.account.raha.af/v1/admin/users/{id} \
-H "Authorization: Bearer {token}"

Response

Empty

Was this page helpful?