Create Business

This endpoint is used to create a new business profile for a user. It requires details about the business and the user's home and business addresses.

Endpoint Description

The auth/create-business endpoint is responsible for creating a user's profile by saving their address and business details. It is a POST request that requires specific user information to be provided in the request body.

URL

POST https://xvdev.xash.co.zw/api/v1/auth/create-business

Headers

  • Accept: application/json

  • Authorization: Bearer Token (e.g., Bearer 8|kn0YdmT1...)

Request Parameters

  • address_line_1 (string, required): First line of the home address.

  • address_line_2 (string, optional): Second line of the home address.

  • city (string, required): City of the home address.

  • business_name (string, required): Name of the business.

  • bp_number (string, optional): Business partner number.

  • business_category (string, required): Category of the business.

  • business_address_line_1 (string, required): First line of the business address.

  • business_address_line_2 (string, optional): Second line of the business address.

  • business_city (string, required): City of the business address.

Request Example

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

var options = {
  method: 'POST',
  url: 'https://xvdev.xash.co.zw/api/v1/auth/create-business',
  headers: {
    Accept: 'application/json',
    Authorization: 'Bearer 8|kn0YdmT1AI3ERgd9rayNx826a932gbvY3cmMnCsD4754a2e0',
  },
  // Data payload...
};

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

Successful Response Example (HTTP 200)

{
  "success": true,
  "message": "Business created successfully."
}

Error Response Example (HTTP 400)

{
  "success": false,
  "message": "Business already created. Please contact support for assistance."
}

Additional Notes

  • The endpoint will create entries in the Business and Address tables using the provided data.

  • If the user's profile has already been created (i.e., address and business details exist), a 400 error response is returned.

  • Ensure that the bearer token is valid and has the required permissions for this operation.

Last updated