Documentation / Recursos Avançados
Recursos Avançados

How to Create Users (Team Members) Via API

Create Users

Overview

The eAgenda platform API allows you to create users (team members) programmatically, enabling the automation of member registration with specific permissions such as owners, managers, collaborators, or viewers. This practical guide explains how to configure an HTTP POST request to the /api/v3/users/ endpoint and process the response. For more details, see the official eAgenda API documentation.

Environment Setup

Before you begin, you will need:

  • API key: Access the eAgenda dashboard to obtain your Bearer token.
  • HTTP request tool: Use cURL, Postman, or libraries such as requests (Python) or axios (JavaScript).
  • Header configuration: Authentication is done via Bearer Token. Set the header Authorization: Bearer and define Content-Type: application/json.

Tip: See the eAgenda authentication documentation to configure the token correctly.

User Data Definition

To create a user (team member), send a JSON object in the request body with the following fields:

{
  "full_name": "string",
  "email": "string",
  "password": "string",
  "accounts": [
    {
      "profile_type": "string",
      "is_active": boolean,
      "account_slug": "string"
    }
  ]
}

full_name (optional)

  • Description: Full name of the team member.
  • Restrictions: Maximum of 50 characters.
  • Impact: Identifies the team member in a user-friendly way within the system.
  • Example: “João Silva”

email (required)

  • Description: Valid email address of the team member.
  • Impact: Used for login and notifications.
  • Example: “joao.silva@example.com

password (optional)

  • Description: Team member’s password.
  • Restrictions: Minimum of 1 character.
  • Impact: Sets the access credentials. If not provided, the system may require configuration later.
  • Example: “senha123”

accounts (optional)

  • Description: List of accounts or sub-accounts the team member will have access to.
  • Structure: Array of JSON objects, each with:
    • profile_type (required): Profile type (owner, manager, oper, read).
      • owner: Account owner.
      • manager: Administrator.
      • oper: Collaborator.
      • read: View only.
    • is_active (optional): Team member’s status in the account (default: true).
    • account_slug (required): Account slug (pattern: ^[-a-zA-Z0-9_]+$).
  • How to obtain the account_slug: Use the eAgenda account listing endpoint (see the documentation).
  • Impact: Defines the team member’s permissions and access to accounts.
  • Example:[ { "profile_type": "oper", "is_active": true, "account_slug": "minha-conta" } ]

Note: The only required field is email. The fields full_name, password, and accounts are optional but recommended for configuring specific permissions.

Sending the Request to Create Users

To create a user (team member), send an HTTP POST request to the endpoint:

https://eagenda.com.br/api/v3/users/

Request Configuration

  • Method: POST
  • Headers:
    • accept: application/json
    • Authorization: Bearer
    • Content-Type: application/json
  • Request body: JSON with the user data.

cURL Request Example

curl -X POST https://eagenda.com.br/api/v3/users/ \
-H "accept: application/json" \
-H "Authorization: Bearer ba08ab41bd58e9b9f82b4d2788b3cd9999ee9999" \
-H "Content-Type: application/json" \
-d '{
  "full_name": "João Silva",
  "email": "joao.silva@example.com",
  "password": "Senha@123",
  "accounts": [
    {
      "profile_type": "oper",
      "is_active": true,
      "account_slug": "minha-conta"
    }
  ]
}'

Python Example (using requests)

import requests

url = "https://eagenda.com.br/api/v3/users/"
headers = {
    "accept": "application/json",
    "Authorization": "Bearer ba08ab41bd58e9b9f82b4d2788b3cd9999ee9999",
    "Content-Type": "application/json"
}
data = {
    "full_name": "João Silva",
    "email": "joao.silva@example.com",
    "password": "senha123",
    "accounts": [
        {
            "profile_type": "oper",
            "is_active": True,
            "account_slug": "minha-conta"
        }
    ]
}

response = requests.post(url, json=data, headers=headers)
print(response.status_code)
print(response.json())

Verifying the Response

The API will return a response with the user creation status. Check the following:

  • HTTP status code:
    • 201 Created: User created successfully.
    • 400 Bad Request: Error in the submitted data (check the JSON).
    • 401 Unauthorized: Invalid or missing token.
  • Response body: Contains the details of the created user, such as:{ "full_name": "João Silva", "email": "joao.silva@example.com", "accounts": [ { "user_profile_key": "1973042a-0d20-4000-8eed-656648396019", "profile_type": "oper", "is_active": true, "account_slug": "minha-conta" } ] }

The user will be registered in the system with the defined permissions. You can use other API endpoints to manage or query team members.

Conclusion

With this tutorial, you learned how to create users (team members) via the eAgenda API, automating registration and defining specific permissions. This integration is ideal for managing teams and accounts efficiently. For more features, such as editing users or managing accounts, see the full eAgenda API documentation.

Contact Us or Learn More

We are here to help! Visit our official channels:

📞 WhatsApp : Click here to send us a message 🌐 eAgenda Platform : Discover eAgenda 🏢 Our Company : Mupi Systems – Innovative Solutions 📧 Email : contato@mupisystems.com.br 📚 Tutorials and Documentation : Access our guides and tutorials