Skip to main content

Company Users Guide

Overview

The User Management API allows you to:

  • Retrieve current user profile information
  • List companies associated with your account
  • View detailed company information and permissions

Get Current User Profile

Retrieve detailed information about the currently authenticated user, including their associated companies.

Endpoint

GET /user/me

Example Request

curl -X GET "https://deepsy.fr/api/v1/user/me" \
-H "Authorization: Bearer deepsy-dev-your-api-key-here"

Response

{
"first_name": "John",
"last_name": "Doe",
"display_name": "John Doe",
"gender": "male",
"age": 30,
"email": "john.doe@example.com",
"phone_number": "+33123456789",
"country": "France",
"city": "Paris",
"profile_picture": "https://example.com/avatar.jpg",
"biography": "Psychology professional with 10 years of experience",
"welcome_message": "2023-01-15T10:30:00Z",
"email_verified_at": "2023-01-15T10:30:00Z",
"companies": [
{
"company_id": "c193a06f-1c25-4e65-84a7-95faaae7ae7b",
"permissions": 6,
"company": {
"name": "Acme Corporation",
"profile_picture": "https://example.com/company-logo.jpg"
}
}
]
}

Response Fields

FieldTypeDescription
first_namestringUser's first name
last_namestringUser's last name
display_namestringUser's display name
genderstringUser's gender
ageintegerUser's age (nullable)
emailstringUser's email address
phone_numberstringUser's phone number (nullable)
countrystringUser's country (nullable)
citystringUser's city (nullable)
profile_picturestringURL to user's profile picture (nullable)
biographystringUser's biography (nullable)
welcome_messagestringTimestamp when welcome message was shown (nullable)
email_verified_atstringEmail verification timestamp (nullable)
companiesarrayList of companies (limited to 10)

Company Object

Each company in the companies array contains:

FieldTypeDescription
company_idstring (UUID)Company identifier
permissionsintegerPermission bitfield for this company
company.namestringCompany name
company.profile_picturestringCompany profile picture URL (nullable)

List User Companies

Retrieve a comprehensive list of all companies the authenticated user is associated with, including detailed company information and permissions.

Endpoint

GET /user/companies

Example Request

curl -X GET "https://deepsy.fr/api/v1/user/companies" \
-H "Authorization: Bearer deepsy-dev-your-api-key-here"

Response

{
"items": [
{
"company_id": "c193a06f-1c25-4e65-84a7-95faaae7ae7b",
"permissions": ["ADMINISTRATOR", "MANAGE_CAMPAIGN"],
"created_at": "2023-01-01T00:00:00Z",
"updated_at": "2023-01-15T10:30:00Z",
"invitation_code": "ABC12345",
"company": {
"name": "Acme Corporation",
"profile_picture": "https://example.com/company-logo.jpg",
"email": "contact@acme.com",
"website": "https://acme.com",
"industry": "Technology",
"size": "50-100",
"country": "France",
"city": "Paris"
}
}
],
"count": 1
}

Response Fields

FieldTypeDescription
itemsarrayList of company memberships
countintegerTotal number of companies

Company Membership Object

Each item in the items array contains:

FieldTypeDescription
company_idstring (UUID)Company identifier
permissionsarrayHuman-readable list of permissions
created_atstringWhen the user joined this company
updated_atstringWhen the relationship was last updated
invitation_codestringInvitation code used to join (nullable)
companyobjectDetailed company information

Detailed Company Object

FieldTypeDescription
namestringCompany name
profile_picturestringCompany profile picture URL (nullable)
emailstringCompany email address (nullable)
websitestringCompany website URL (nullable)
industrystringCompany industry (nullable)
sizestringCompany size (nullable)
countrystringCompany country (nullable)
citystringCompany city (nullable)

Understanding Permissions

Permissions in the /user/me endpoint are returned as integers (bitfield values), while in /user/companies they're returned as human-readable strings.

For more information about the permission system, see our Permissions Guide.

Error Responses

401 Unauthorized

{
"error": "API key not provided",
"error_code": "API_KEY_NOT_PROVIDED"
}

500 Internal Server Error

{
"error": "Internal server error"
}

Best Practices

  1. Cache User Data: User profile information doesn't change frequently, so consider caching the response
  2. Handle Nullable Fields: Many user profile fields can be null, ensure your application handles this gracefully
  3. Permission Checking: Always check user permissions before attempting operations on companies
  4. Company Limits: The /user/me endpoint limits companies to 10, use /user/companies for complete lists