Skip to content

Vendor Information API

This API allows vendor to manage account details.


Endpoints Overview

Method Endpoint Description
GET /api/v1/vendor/accounts/information/ Retrieve vendor details.
PATCH /api/v1/vendor/accounts/information/ Update vendor details (telephone, address). the vendor's shop.

Vendor Detail API

1. Retrieve Vendor Details

Endpoint

  • URL: /api/v1/vendor/accounts/information/
  • Method: GET
  • Permission Required: IsAuthenticated (Vendor Only)

Description

Retrieves the details of the authenticated vendor.

Example Request

This is the example request

GET /api/v1/vendor/accounts/information/


Success

{
    "email": "vendor@example.com",
    "phone": "+1234567890",
    "role": "vendor",
    "telephone": "0123456789",
    "company_address": "123 Street, City, Country",
    "shop_name": "Vendor's Shop",
    "created_at": "2025-01-01T12:00:00Z"
}


2. Update Vendor Details

Endpoint

  • URL: /api/v1/vendor/accounts/information/
  • Method: PATCH
  • Permission Required: IsAuthenticated (Vendor Only)

Description

Allows vendors to update their profile details (telephone, company address).

Example Request

This is the example request

PATCH /api/v1/vendor/accounts/information/


Request Body

This is the request body

{
    "telephone": "222222222"
}


Success

{
    "message": "Profile Information updated successfully!."
}


Error

{
  "error": "Vendor not found"
}


3. Delete Vendor Account

Endpoint

  • URL: /api/v1/vendor/accounts/delete/
  • Method: DELETE
  • Permission Required: IsAuthenticated (Vendor Only)

Description

Soft deletes the vendor account by setting is_active to False.

Example Request

This is the example request

DELETE /api/v1/vendor/accounts/delete/


Success

{
    "message": "Your account has been deleted."
}


Error

{
  "error": "Unauthorized"
}


4. Change Vendor Password

Endpoint

  • URL: /api/v1/vendor/accounts/change-password/
  • Method: PATCH
  • Permission Required: IsAuthenticated (Vendor Only)

Description

Allows vendors to change their password. If Two-Factor Authentication (2FA) is enabled, an OTP verification is required before proceeding with the password change.

Example Request

This is the example request

PATCH /api/v1/vendor/accounts/change-password/


Request Body

This is the request body

{
  "old_password": "oldpassword123",
  "new_password": "newpassword456",
  "confirm_password": "newpassword456"
}

This is the request body with 2FA

{
  "temp_token": "generated-temp-token",
  "otp": "123456",
  "new_password": "newpassword456",
  "confirm_password": "newpassword456"
}


Success

{
    "message": "Password changed successfully."
}


Error

{
  "error": "Old password is incorrect."
}
{
  "error": "New password cannot be the same as the old password."
}
{
  "error": "Invalid OTP or expired temp token."
}