POST
/
{guru_slug}
/
profiles
/
Upsert User Profiles
curl --request POST \
  --url https://api.gurubase.io/api/v1/{guru_slug}/profiles/ \
  --header 'Content-Type: application/json' \
  --data '{
  "users": [
    {
      "external_user_id": "<string>",
      "memory": {}
    }
  ]
}'
{
    "status": "success",
    "total_users": 2,
    "processed_users": 2,
    "users_results": [
        {
            "user_index": 0,
            "external_user_id": "user1-id",
            "success": true,
            "errors": []
        },
        {
            "user_index": 1,
            "external_user_id": "user2-id",
            "success": true,
            "errors": []
        }
    ]
}
This endpoint allows you to create or update user profiles in bulk. It is an idempotent operation, meaning you can safely retry requests without creating duplicate profiles.

Path Parameters

guru_slug
string
required
The slug of the Guru to which the profiles belong.

Body Parameters

users
object[]
required
An array of user profile objects to upsert.

Example Request

{
    "users": [
        {
            "external_user_id": "user1-id",
            "memory": {
                "name": "John Doe",
                "email": "[email protected]"
            }
        },
        {
            "external_user_id": "user2-id", 
            "memory": {
                "name": "Jane Doe",
                "plan": "premium"
            }
        }
    ]
}

Response

The response provides a detailed breakdown of the upsert operation.
status
string
Indicates the overall status of the request. Will be “success” if the request was accepted and partially or fully processed.
total_users
number
The total number of users in the request payload.
processed_users
number
The number of users successfully processed.
users_results
array
An array of result objects, one for each user in the request, in the same order.
{
    "status": "success",
    "total_users": 2,
    "processed_users": 2,
    "users_results": [
        {
            "user_index": 0,
            "external_user_id": "user1-id",
            "success": true,
            "errors": []
        },
        {
            "user_index": 1,
            "external_user_id": "user2-id",
            "success": true,
            "errors": []
        }
    ]
}