Profile

The Profile API allows authenticated users to retrieve their profile information.

Endpoint

GET /api/v1/profile

Request

This is a GET request requiring an authentication token.

Headers

  • Accept: The response format, typically application/json

  • Authorization: Bearer token for authentication

Example Request

var axios = require("axios").default;

var options = {
  method: 'GET',
  url: 'https://xvdev.xash.co.zw/api/v1/profile',
  headers: {
    Accept: 'application/json',
    Authorization: 'Bearer [Your_Token]'
  }
};

axios.request(options).then(function (response) {
  console.log(response.data);
}).catch(function (error) {
  console.error(error);
});

Response

The response includes a success flag and the user's profile information.

Response Format

{
  "success": true,
  "profile": {
    "phone": "[Phone Number]",
    "first_name": "[First Name]",
    "last_name": "[Last Name]",
    // Additional profile details
    "address": {
      // Address details
    },
    "business": {
      // Business details
    }
  }
}

Success Response

A successful response returns a 200 OK status with the user's profile details.

Error Response

  • 401 Unauthorized: Returned when the authentication token is missing or invalid.

  • 500 Internal Server Error: General server error when the request cannot be processed.

Notes

  • Ensure that the authentication token is kept secure.

  • Replace [Your_Token] with the actual bearer token in the request.

  • Sensitive information like phone and email should be handled with care.

Last updated