Skip to content

Manage Speak AI account users with the admin endpoints

Create users in your Speak AI account, update an existing user, and list every user the account contains. These endpoints are for account admins.

Updated View as MarkdownAsk ClaudeOpen in ChatGPTllms.txt

The Speak AI API exposes 3 admin endpoints under the base URL https://api.speakai.co/v1. Every request needs the x-speakai-key and x-access-token headers described in Authentication.

Manage your team.

What can you do with the admin endpoints?

Speak AI groups these 3 endpoints under the admin resource. Each entry below links to the full reference for that endpoint further down this page.

Create New User

POST/admin/user

Add User Endpoint

This endpoint allows administrators to add a new user to the system. The request requires a JSON payload containing user details.

Request Parameters

The request body should be in JSON format and include the following parameters:

  • firstName (string): The first name of the user.

  • lastName (string): The last name of the user.

  • email (string): The email address of the user.

  • isActive (boolean): Indicates whether the user account is active.

  • isVerified (boolean): Indicates whether the user’s email has been verified.

  • permission (object): An object specifying the permissions granted to the user:

    • audio (boolean): Permission to access audio features.

    • video (boolean): Permission to access video features.

    • text (boolean): Permission to access text features.

    • addPayment (boolean): Permission to manage payment options.

    • userManagement (boolean): Permission to manage other users.

Expected Response

Upon a successful request, the server will respond with a confirmation of the user creation, typically including the user ID and any other relevant details about the newly created user.

Notes
  • Ensure that the email provided is unique and valid to avoid conflicts.

  • Permissions should be assigned based on the user’s role within the organization.

  • This endpoint is restricted to users with administrative privileges.

Request body

Field types and names come from the request body the spec records. The spec does not mark request body fields as required, so read this as the shape the endpoint accepts rather than a required field list.

Field Type
firstName string
lastName string
email string
isActive boolean
isVerified boolean
permission object
permission.audio boolean
permission.video boolean
permission.text boolean
permission.addPayment boolean
permission.userManagement boolean
Example request
curl -X POST 'https://api.speakai.co/v1/admin/user' \
  -H 'x-speakai-key: sk_test_speak_0000000000000000' \
  -H 'x-access-token: eyJhbGciOiJIUzI1NiJ9.test-access-token.0000000000' \
  -H 'Content-Type: application/json' \
  -d '{
  "firstName": "Vatsal",
  "lastName": "Shah",
  "email": "test@abc.com",
  "isActive": true,
  "isVerified": true,
  "permission": {
    "audio": true,
    "video": true,
    "text": true,
    "addPayment": false,
    "userManagement": false
  }
}'
Response

200 Success

The spec records this status code with no example body.

Update User

PUT/admin/user

Update User Details

This endpoint allows administrators to update the details of a user in the system. It is a PUT request that modifies the user’s information based on the provided payload.

Request Parameters

The request body should be a JSON object with the following parameters:

  • _id (string): The unique identifier of the user to be updated.

  • email (string): The email address of the user. This field can be left empty if no change is required.

  • firstName (string): The first name of the user.

  • lastName (string): The last name of the user.

  • isActive (boolean): Indicates whether the user account is active.

  • isVerified (boolean): Indicates whether the user’s email has been verified.

  • permission (object): An object that defines the permissions for the user with the following keys:

    • audio (boolean): Permission to access audio features.

    • video (boolean): Permission to access video features.

    • text (boolean): Permission to access text features.

    • addPayment (boolean): Permission to add payment methods.

    • userManagement (boolean): Permission to manage other users.

Expected Response

Upon a successful update, the API will return a response indicating the status of the operation. The response typically includes a success message and may also return the updated user details.

Notes
  • Ensure that the user ID provided in the request is valid and corresponds to an existing user in the system.

  • The permissions object allows for fine-grained control over what the user can access, so be sure to set these values according to your application’s requirements.

  • If any required fields are missing or invalid, the API will return an error response with details about the issue.

Request body

Field types and names come from the request body the spec records. The spec does not mark request body fields as required, so read this as the shape the endpoint accepts rather than a required field list.

Field Type
_id string
email string
firstName string
lastName string
isActive boolean
isVerified boolean
permission object
permission.audio boolean
permission.video boolean
permission.text boolean
permission.addPayment boolean
permission.userManagement boolean
Example request
curl -X PUT 'https://api.speakai.co/v1/admin/user' \
  -H 'x-speakai-key: sk_test_speak_0000000000000000' \
  -H 'x-access-token: eyJhbGciOiJIUzI1NiJ9.test-access-token.0000000000' \
  -H 'Content-Type: application/json' \
  -d '{
  "_id": "string",
  "email": "",
  "firstName": "Vatsal",
  "lastName": "Shah",
  "isActive": true,
  "isVerified": true,
  "permission": {
    "audio": true,
    "video": true,
    "text": true,
    "addPayment": false,
    "userManagement": false
  }
}'
Response

200 Success

The spec records this status code with no example body.

List users

GET/admin/users

Get Users

This endpoint retrieves a list of users from the admin panel. It is primarily used by administrators to access user information stored in the system.

Request
  • Method: GET

  • Endpoint: https://api.speakai.co/v1/admin/users

Response

The response will contain a JSON object with the following structure:

  • users: An array of user objects, where each user object includes:

    • id: Unique identifier for the user.

    • name: The name of the user.

    • email: The email address of the user.

    • role: The role assigned to the user (e.g., admin, user).

    • status: The current status of the user (e.g., active, inactive).

Example Response
{
  "users": [
    {
      "id": "123",
      "name": "John Doe",
      "email": "john.doe@example.com",
      "role": "admin",
      "status": "active"
    },
    {
      "id": "124",
      "name": "Jane Smith",
      "email": "jane.smith@example.com",
      "role": "user",
      "status": "inactive"
    }
  ]
}
Notes
  • Ensure that appropriate authentication and authorization headers are included in the request to access this endpoint.

  • The response may vary based on the user’s permissions and the number of users in the system.

Example request
curl -X GET 'https://api.speakai.co/v1/admin/users' \
  -H 'x-speakai-key: sk_test_speak_0000000000000000' \
  -H 'x-access-token: eyJhbGciOiJIUzI1NiJ9.test-access-token.0000000000'
Response

200 Success

The spec records this status code with no example body.

Get an API key on the Speak AI developer page.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close