Skip to main content

Users API Reference

Overview

The Users API offers tools for managing user accounts on your Publica.la platform. It includes functionality for creating, updating, deactivating, and reactivating users, as well as managing user sessions and permissions.

info

Make sure you generated the api_token on your store. More info in the API Authentication guide

Endpoint Reference

EndpointMethodDescription
/integration-api/v1/dashboard/usersPOSTCreate a new user
/integration-api/v1/dashboard/usersGETList or search for users
/integration-api/v1/dashboard/users/(id)PUTUpdate an existing user
/integration-api/v1/dashboard/users/(id)DELETEDeactivate a user
/integration-api/v1/dashboard/users/(id)/re-activatePUTReactivate a user
/integration-api/v1/users/(id)/force-logoutPOSTForce user logout

Create a User

Create a new user account on the platform.

Endpoint: POST /integration-api/v1/dashboard/users/

Request Fields

FieldTypeDescriptionRequired
emailstringUser's email addressYes
external_idstringYour unique identifier for this userYes
new_passwordstringUser's passwordRecommended
sessions_limitintegerLimit of simultaneous sessions (max 999999)No
assign_new_planintegerPlan ID to assign to the userNo
new_plan_custom_valid_tostringPlan expiration date (YYYY-MM-DD)No
adminbooleanWhether user has admin privilegesNo
plan_adminbooleanWhether user has plan admin privilegesNo
only_sees_readablebooleanWhether user only sees readable contentNo

Example Request

{
"email": "[email protected]",
"external_id": "user-id-in-your-platform",
"new_password": "Abcd1234",
"sessions_limit": null,
"assign_new_plan": null,
"new_plan_custom_valid_to": "",
"admin": false,
"plan_admin": false,
"only_sees_readable": true
}

Response Fields

FieldDescriptionType
CODEResponse status codestring
data.idUser IDinteger
data.emailUser emailstring
data.uuidUnique user identifierstring
data.pictureUser profile picture URLstring
data.adminAdmin statusboolean
data.plan_adminPlan admin statusboolean
data.only_sees_readableWhether user only sees readable contentboolean
data.sessions_limitUser session limitinteger
data.created_atCreation timestampobject
data.updated_atLast update timestampobject
data.deleted_atDeletion timestamp (if applicable)object

Example Response

{
"CODE": "success",
"data": {
"id": 923242,
"email": "[email protected]",
"uuid": "af5af4f9-9b8d-4d79-b162-0cec4279cae5",
"picture": "https://www.gravatar.com/avatar/5c472faa5105266a3d41aee277eb9d0c?s=160&d=mm&r=g",
"admin": false,
"plan_admin": false,
"only_sees_readable": false,
"sessions_limit": null,
"created_at": {
"timestamp": 1620931649,
"date": "2021-05-13 18:47:29",
"timezone": "UTC"
},
"updated_at": {
"timestamp": 1621256387,
"date": "2021-05-17 12:59:47",
"timezone": "UTC"
},
"deleted_at": null
}
}

Response Codes

CodeDescription
200User created successfully
422Validation error (details in response)
401Unauthorized (invalid API token)

Retrieve Users

List or search for users.

Endpoint: GET /integration-api/v1/dashboard/users

Query Parameters

ParameterDescriptionExample
query=emailFilter by user email/integration-api/v1/dashboard/users/[email protected]
query=deactivatedShow only deactivated users/integration-api/v1/dashboard/users/?query=deactivated
query=adminsShow only admin users/integration-api/v1/dashboard/users/?query=admins

Response

The response includes detailed user information and pagination metadata when listing multiple users.

Example Response (List)

{
"CODE": "success",
"data": {
"paginator": {
"current_page": 1,
"data": [
{
"id": 923242,
"uuid": "af5af4f9-9b8d-4d79-b162-0cec4279cae5",
"admin": false,
"plan_admin": false,
"email": "[email protected]",
"sessions_limit": 1,
"only_sees_readable": 1,
"picture": "https://www.gravatar.com/avatar/98789c9d5825d6f6c6615313ffcaf1ac?s=160&d=mm&r=g",
"created_at": "2021-05-18T13:28:53.000000Z",
"updated_at": "2021-05-18T13:28:53.000000Z",
"deleted_at": null,
"purchased_issues_with_cancelled_count": 0,
"user_plans_count": 0,
"can_be_edited": true,
"created_at_date_string": "2021-05-18",
"impersonate": "https://example.publica.la/impersonate/take/53114",
"sessions": null,
"ip_ranges": [],
"referrers": [],
"purchased_issues_with_cancelled": [],
"user_plans": []
},
// ... more users ...
],
// ... pagination fields ...
}
}
}

Response Codes

CodeDescription
200Success
404User not found
401Unauthorized (invalid API token)

Update a User

Update an existing user's information.

Endpoint: PUT /integration-api/v1/dashboard/users/(id)

Request Fields

FieldTypeDescriptionRequired
emailstringUser's email addressYes
external_idstringYour unique identifier for this userYes
new_passwordstringUser's new passwordNo
sessions_limitintegerLimit of simultaneous sessionsNo
assign_new_planintegerPlan ID to assign to the userNo
new_plan_custom_valid_tostringPlan expiration date (YYYY-MM-DD)No
adminbooleanWhether user has admin privileges (1 or 0)No
plan_adminbooleanWhether user has plan admin privileges (1 or 0)No
only_sees_readablebooleanWhether user only sees readable content (1 or 0)Yes
user_plan_namestringName for the user's planNo

Response Codes

CodeDescription
204User updated successfully
422Validation error (details in response)
401Unauthorized (invalid API token)

Deactivate a User

Deactivate a user, preventing them from logging in.

Endpoint: DELETE /integration-api/v1/dashboard/users/(id)

important

A deactivated user cannot log in through any means until reactivated.

Example Request

  • DELETE /integration-api/v1/dashboard/users/923242

Response

{
"CODE": "success",
"data": []
}

Response Codes

CodeDescription
200User deactivated successfully
404User not found
401Unauthorized (invalid API token)

Reactivate a User

Reactivate a previously deactivated user.

Endpoint: PUT /integration-api/v1/dashboard/users/(id)/re-activate

Example Request

  • PUT /integration-api/v1/dashboard/users/923242/re-activate

Response

{
"CODE": "success",
"data": 1
}

Response Codes

CodeDescription
200User reactivated successfully
404User not found
401Unauthorized (invalid API token)

Force User Logout

Force a user to log out of all active sessions.

Endpoint: POST /integration-api/v1/users/(id)/force-logout

important

After logging out, the user will be redirected to the initial URL on their next interaction with the system.

The endpoint accepts either the numeric ID or the external_id as the user identifier. Note that if the external-auth-token is used, the external_id is the UUID contained in the token.

Example Request

  • POST /integration-api/v1/users/923242/force-logout

Response Codes

CodeDescription
200User logged out successfully
404User not found
401Unauthorized (invalid API token)
X

Graph View