BizCARE MyInvois
Shopify Integration/User Management

Create User

Create a new user in the system

Create User

Create a new user in the system with the provided information.

Endpoint

POST /api/integrations/users

Request Body

FieldTypeRequiredDescription
namestringYesFull name of the user
firstNamestringNoFirst name of the user
lastNamestringNoLast name of the user
emailstringYesEmail address (must be unique)
phonestringNoPhone number
dobstringNoDate of birth (ISO 8601 format)
rolestringNoUser role (default: "customer")

Request Example

{
  "name": "Jane Smith",
  "firstName": "Jane",
  "lastName": "Smith",
  "email": "jane@example.com",
  "phone": "+1234567890",
  "dob": "1985-03-20",
  "role": "customer"
}

Response Format

{
  "id": "user-456",
  "name": "Jane Smith",
  "firstName": "Jane",
  "lastName": "Smith",
  "email": "jane@example.com",
  "phone": "+1234567890",
  "dob": "1985-03-20",
  "role": "customer",
  "members": [],
  "createdAt": "2024-01-15T14:30:00Z",
  "updatedAt": "2024-01-15T14:30:00Z"
}

Examples

cURL Example

curl -X POST "https://api.example.com/api/integrations/users" \
  -H "X-Invois-Key: your-api-key-here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Jane Smith",
    "email": "jane@example.com",
    "role": "customer"
  }'

JavaScript Example

const userData = {
  name: "Jane Smith",
  firstName: "Jane",
  lastName: "Smith",
  email: "jane@example.com",
  role: "customer"
};

const response = await fetch('https://api.example.com/api/integrations/users', {
  method: 'POST',
  headers: {
    'X-Invois-Key': 'your-api-key-here',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(userData)
});

const newUser = await response.json();

Validation Rules

  • Email: Must be a valid email format and unique in the system
  • Name: Required, minimum 2 characters
  • Role: Must be one of: super-admin, admin, customer
  • Phone: Optional, must be valid phone number format if provided
  • Date of Birth: Optional, must be valid ISO 8601 date if provided

Error Responses

  • 400 Bad Request - Validation errors or missing required fields
  • 401 Unauthorized - Invalid or missing API key
  • 409 Conflict - Email already exists
  • 429 Too Many Requests - Rate limit exceeded

Validation Error Example

{
  "error": "Validation Error",
  "message": "The request contains invalid data",
  "details": {
    "email": ["Email is already taken"],
    "name": ["Name is required"]
  }
}

Next Steps