Account

These endpoints allow you to manage account settings and notifications.

The profile object

Properties

  • Name
    id
    Type
    string
    Description

    Unique identifier for the profile.

  • Name
    name
    Type
    string
    Description

    The user's full name.

  • Name
    email
    Type
    string
    Description

    The user's email address.

  • Name
    email_verified_at
    Type
    timestamp
    Description

    When the email was verified. Null if unverified.

  • Name
    plan
    Type
    integer
    Description

    The user's current subscription plan.

  • Name
    status
    Type
    integer
    Description

    The account status.

  • Name
    balance
    Type
    number
    Description

    Current balance of the account.

  • Name
    default_project_id
    Type
    string
    Description

    ID of the user's default project.

  • Name
    plan_expires_at
    Type
    timestamp
    Description

    When the current plan expires. Null if no active plan.

  • Name
    created_at
    Type
    timestamp
    Description

    When the account was created.

  • Name
    updated_at
    Type
    timestamp
    Description

    When the account was last updated.

  • Name
    deleted_at
    Type
    timestamp
    Description

    When the account was deleted. Null if active.

  • Name
    referrer_id
    Type
    string
    Description

    ID of the user who referred this account. Null if none.

Example profile object

{
  "id": "9ddc0e2a-74cc-434c-bb93-1d0a39fdf9c8",
  "name": "Test User", 
  "email": "[email protected]",
  "email_verified_at": "2024-12-31T22:36:00.000000Z",
  "plan": 0,
  "status": 0,
  "balance": 0,
  "default_project_id": "9eacd37f-ca6d-4d6f-9079-938fb858433b",
  "plan_expires_at": null,
  "created_at": "2024-12-31T22:36:00.000000Z",
  "updated_at": "2024-12-31T22:36:00.000000Z",
  "deleted_at": null,
  "referrer_id": null
}

The notification object

Properties

  • Name
    id
    Type
    string
    Description

    Unique identifier for the notification.

  • Name
    type
    Type
    string
    Description

    The notification class type.

  • Name
    notifiable_id
    Type
    string
    Description

    ID of the user receiving the notification.

  • Name
    notifiable_model
    Type
    string
    Description

    The model type of the notification recipient.

  • Name
    data
    Type
    object
    Description
    • Name
      id
      Type
      string
      Description

      Related resource ID.

    • Name
      name
      Type
      string
      Description

      Related resource name.

  • Name
    read_at
    Type
    timestamp
    Description

    When the notification was read. Null if unread.

  • Name
    created_at
    Type
    timestamp
    Description

    When the notification was created.

  • Name
    updated_at
    Type
    timestamp
    Description

    When the notification was last updated.

Example notification object

{
  "id": "90ad6790-239e-42da-87d5-d14f5be6fb6f",
  "type": "App\\Notifications\\V1\\Project\\CreateNotification",
  "notifiable_id": "9dc7c626-1a10-435f-a23e-d32b4c86bee1",
  "notifiable_model": null,
  "data": {
    "id": "9dd18f0c-c394-484c-9ae3-d726578a7cea",
    "name": "First Test"
  },
  "read_at": null,
  "created_at": "2024-12-26T17:22:17.000000Z",
  "updated_at": "2024-12-26T17:22:17.000000Z"
}

The token object

Properties

  • Name
    id
    Type
    integer
    Description

    Unique identifier for the token.

  • Name
    tokenable_type
    Type
    string
    Description

    The type of entity the token belongs to (e.g., "App\Models\User").

  • Name
    tokenable_id
    Type
    string
    Description

    ID of the entity that owns the token.

  • Name
    name
    Type
    string
    Description

    Name given to the token.

  • Name
    abilities
    Type
    array
    Description

    List of permissions granted to this token.

  • Name
    last_used_at
    Type
    timestamp
    Description

    When the token was last used. Null if never used.

  • Name
    expires_at
    Type
    timestamp
    Description

    When the token expires. Null if no expiration.

  • Name
    created_at
    Type
    timestamp
    Description

    When the token was created.

  • Name
    updated_at
    Type
    timestamp
    Description

    When the token was last updated.

Example token object

{
  "id": 12681,
  "tokenable_type": "App\\Models\\User",
  "tokenable_id": "9ddc0e2a-74cc-434c-bb93-1d0a39fdf9c8",
  "name": "API Token",
  "abilities": ["*"],
  "last_used_at": "2025-04-04T10:18:06.000000Z",
  "expires_at": null,
  "created_at": "2025-04-04T10:07:08.000000Z",
  "updated_at": "2025-04-04T10:18:06.000000Z"
}

GET/my/account/profile

Get profile

Retrieve the profile information for the authenticated user.

Request

GET
/my/account/profile
curl -X GET https://api.tradevps.net/v1/my/account/profile \
  -H "Accept: application/json" \
  -H "Authorization: Bearer {token}"

Response 200

{
  "ok": true,
  "msg": "Profile fetched",
  "data": {
    "id": "9ddc0e2a-74cc-434c-bb93-1d0a39fdf9c8",
    "name": "Test User",
    "email": "[email protected]",
    "email_verified_at": "2024-12-31T22:36:00.000000Z",
    "plan": 0,
    "status": 0,
    "balance": 0,
    "default_project_id": "9eacd37f-ca6d-4d6f-9079-938fb858433b",
    "plan_expires_at": null,
    "created_at": "2024-12-31T22:36:00.000000Z",
    "updated_at": "2024-12-31T22:36:00.000000Z",
    "deleted_at": null,
    "referrer_id": null
  }
}

PATCH/my/account/profile

Update Profile

Update the authenticated user's profile information. You can update the name and default project.

Request Body

  • Name
    name
    Type
    string
    Description

    The user's full name. Must be between 3 and 255 characters.

  • Name
    default_project_id
    Type
    string
    Description

    ID of the project to set as default. Must be one of your existing projects.

Validation Rules

  • name: Optional, string, 3-255 characters
  • default_project_id: Optional, must exist in your projects

Request

PATCH
/my/account/profile
curl -X PATCH https://api.tradevps.net/v1/my/account/profile \
  -H "Accept: application/json" \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "New User Name",
    "default_project_id": "9eacd37f-ca6d-4d6f-9079-938fb858433b"
  }'

Response

{
  "ok": true,
  "msg": "The profile updated",
  "data": null
}

GET/my/account/notifications

List notifications

Retrieve a paginated list of notifications for the authenticated user.

Optional parameters

  • Name
    page
    Type
    integer
    Description

    Page number for pagination.

  • Name
    per_page
    Type
    integer
    Description

    Number of items per page (default: 15).

  • Name
    unread
    Type
    boolean
    Description

    When set to true, returns only unread notifications.

Request

GET
/my/account/notifications
curl -X GET https://api.tradevps.net/v1/my/account/notifications?unread=true \
  -H "Accept: application/json" \
  -H "Authorization: Bearer {token}"

Response 200

{
  "ok": true,
  "msg": "Notification fetched.",
  "data": [
    {
      "id": "90ad6790-239e-42da-87d5-d14f5be6fb6f",
      "type": "App\\Notifications\\V1\\Project\\CreateNotification",
      "notifiable_id": "9dc7c626-1a10-435f-a23e-d32b4c86bee1",
      "notifiable_model": null,
      "data": {
        "id": "9dd18f0c-c394-484c-9ae3-d726578a7cea",
        "name": "First Test"
      },
      "read_at": null,
      "created_at": "2024-12-26T17:22:17.000000Z",
      "updated_at": "2024-12-26T17:22:17.000000Z"
    }
  ],
  "pagination": {
    "current_page": 1,
    "last_page": 1,
    "per_page": 15,
    "total": 2,
    "first_page_url": "http://127.0.0.1:8000/v1/my/account/notifications?page=1",
    "from": 1,
    "last_page_url": "http://127.0.0.1:8000/v1/my/account/notifications?page=1",
    "next_page_url": null,
    "prev_page_url": null
  }
}
GET/my/account/offers

Get account offers

Retrieve the current offers available for the authenticated user's account.

Properties

  • Name
    welcome_days
    Type
    integer
    Description

    Remaining days the user can claim the welcome discount offer. Zero if expired or already used.

Request

GET
/my/account/offers
curl -X GET https://api.tradevps.net/v1/my/account/offers \
  -H "Accept: application/json" \
  -H "Authorization: Bearer {token}"

Response 200

{
  "ok": true,
  "msg": "The user account offers",
  "data": {
    "welcome_days": 0
  }
}
POST/my/account/notifications/{id}/read

Mark notification as read

Mark a specific notification as read. Returns the updated notification object.

URL Parameters

  • Name
    id
    Type
    string
    Description

    The unique identifier of the notification to mark as read.

Request

POST
/my/account/notifications/{id}/read
curl -X POST https://api.tradevps.net/v1/my/account/notifications/123e4567-e89b-12d3-a456-426614174000/read \
  -H "Accept: application/json" \
  -H "Authorization: Bearer {token}"

Response 200

{
  "ok": true,
  "message": "Notification marked as read",
  "data": {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "type": "App\\Notifications\\SomeNotification",
    "notifiable_id": "user_id",
    "notifiable_model": "App\\Models\\User",
    "data": {},
    "read_at": "2024-01-20T12:00:00.000000Z",
    "created_at": "2024-01-19T12:00:00.000000Z",
    "updated_at": "2024-01-20T12:00:00.000000Z"
  }
}
POST/my/account/notifications/read-all

Mark all notifications as read

Mark all unread notifications as read for the authenticated user. Returns an array of updated notification objects.

Request

POST
/my/account/notifications/read-all
curl -X POST https://api.tradevps.net/v1/my/account/notifications/read-all \
  -H "Accept: application/json" \
  -H "Authorization: Bearer {token}"

Response 200

{
  "ok": true,
  "message": "All notifications marked as read",
  "data": [
    {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "type": "App\\Notifications\\SomeNotification",
      "notifiable_id": "user_id",
      "notifiable_model": "App\\Models\\User",
      "data": {},
      "read_at": "2024-01-20T12:00:00.000000Z",
      "created_at": "2024-01-19T12:00:00.000000Z",
      "updated_at": "2024-01-20T12:00:00.000000Z"
    }
  ]
}
GET/my/account/tokens

List API tokens

Retrieve a paginated list of API tokens for the authenticated user.

Optional parameters

  • Name
    page
    Type
    integer
    Description

    Page number for pagination.

  • Name
    per_page
    Type
    integer
    Description

    Number of items per page (default: 10).

Request

GET
/my/account/tokens
curl -X GET https://api.tradevps.net/v1/my/account/tokens \
  -H "Accept: application/json" \
  -H "Authorization: Bearer {token}"

Response 200

{
  "ok": true,
  "msg": "API tokens fetched",
  "data": [
    {
      "id": 12681,
      "tokenable_type": "App\\Models\\User",
      "tokenable_id": "9ddc0e2a-74cc-434c-bb93-1d0a39fdf9c8",
      "name": "API Token",
      "abilities": ["*"],
      "last_used_at": "2025-04-04T10:18:06.000000Z",
      "expires_at": null,
      "created_at": "2025-04-04T10:07:08.000000Z",
      "updated_at": "2025-04-04T10:18:06.000000Z"
    }
  ],
  "pagination": {
    "current_page": 1,
    "last_page": 836,
    "per_page": 10,
    "total": 8352,
    "first_page_url": "http://127.0.0.1:8000/v1/my/account/tokens?page=1",
    "from": 1,
    "last_page_url": "http://127.0.0.1:8000/v1/my/account/tokens?page=836",
    "next_page_url": "http://127.0.0.1:8000/v1/my/account/tokens?page=2",
    "prev_page_url": null
  }
}
POST/my/account/tokens

Create token

Create a new API token for the authenticated user. The generated token will be returned only once in the response.

Required parameters

  • Name
    name
    Type
    string
    Description

    A name to identify the token. Maximum length is 255 characters.

Optional parameters

  • Name
    expires_at
    Type
    string
    Description

    ISO 8601 formatted datetime when the token should expire. Must be a future date (e.g., "2024-12-31T23:59:59Z"). If not provided, the token will never expire.

  • Name
    abilities
    Type
    array
    Description

    List of permissions to grant to this token. Available options: read, write, delete. If not provided, defaults to all abilities (["*"]).

Request

POST
/my/account/tokens
curl -X POST https://api.tradevps.net/v1/my/account/tokens \
  -H "Accept: application/json" \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "My API Token",
    "expires_at": "2024-12-31T23:59:59Z",
    "abilities": ["read", "write", "delete"]
  }'

Response 200

{
  "ok": true,
  "msg": "API token generated",
  "data": {
    "token": "12683|ZDiVXbGAkllUTtDRmWazV5XPn2MZhoUKPnaKCkOH5f6b02b2",
    "name": "My API Token"
  }
}

Response 422

{
  "message": "The name field is required.",
  "errors": {
    "name": [
      "The name field is required."
    ],
    "expires_at": [
      "The expires at must be a date after now."
    ],
    "abilities.0": [
      "The selected abilities.0 is invalid."
    ]
  }
}
DELETE/my/account/tokens/{id}

Revoke token

Revoke an existing API token. Once revoked, the token can no longer be used for authentication.

URL Parameters

  • Name
    id
    Type
    integer
    Description

    The unique identifier of the token to revoke. This is the first part of the token string before the | character.

Note

When you receive a token after creation, it has the format: {id}|{hash}. To revoke the token, you only need the id part.

For example, if you received a token:

12683|ZDiVXbGAkllUTtDRmWazV5XPn2MZhoUKPnaKCkOH5f6b02b2

You would use 12683 as the ID in the revocation request.

Request

DELETE
/my/account/tokens/{id}
curl -X DELETE https://api.tradevps.net/v1/my/account/tokens/12683 \
  -H "Accept: application/json" \
  -H "Authorization: Bearer {token}"

Response 200

{
  "ok": true,
  "msg": "API token revoked",
  "data": null
}

POST/my/account/security/change-password

Change password

Change the password for the authenticated user's account.

Warning: Changing your password will automatically revoke all existing API tokens. You will need to generate new tokens either by using the login endpoint or creating new tokens after changing your password.

Required parameters

  • Name
    current_password
    Type
    string
    Description

    The user's current password. Must be at least 6 characters.

  • Name
    new_password
    Type
    string
    Description

    The new password. Must be at least 6 characters and different from the current password.

  • Name
    new_password_confirmation
    Type
    string
    Description

    Confirmation of the new password. Must match the new password exactly.

Request

POST
/my/account/security/change-password
curl -X POST https://api.tradevps.net/v1/my/account/security/change-password \
  -H "Accept: application/json" \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "current_password": "current123",
    "new_password": "newpass123",
    "new_password_confirmation": "newpass123"
  }'

Response 200

{
  "ok": true,
  "msg": "Password changed successfully",
  "data": null
}

Response 422 (Missing Fields)

{
  "message": "The current password field is required. (and 2 more errors)",
  "errors": {
    "current_password": [
      "The current password field is required."
    ],
    "new_password": [
      "The new password field is required."
    ],
    "new_password_confirmation": [
      "The new password confirmation field is required."
    ]
  }
}

Response 422 (Validation Failed)

{
  "message": "The new password field must be at least 6 characters. (and 1 more error)",
  "errors": {
    "new_password": [
      "The new password field must be at least 6 characters."
    ],
    "new_password_confirmation": [
      "The new password confirmation field must match new password."
    ]
  }
}