Get a User - Cognigy Documentation

Get a User

GET /management/v2.0/users/{userId}

Example cURL Command

curl --request GET \
  --url https://api-trial.cognigy.ai/new/management/v2.0/users/{userId} \
  --header 'Authorization: Basic <encoded-value>'

Example Python Code

import requests

url = "https://api-trial.cognigy.ai/new/management/v2.0/users/{userId}"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)

Example JavaScript Code

const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};

fetch('https://api-trial.cognigy.ai/new/management/v2.0/users/{userId}', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));

Example PHP Code

$curl = curl_init();
curl_setopt_array($curl, [
  CURLOPT_URL => "https://api-trial.cognigy.ai/new/management/v2.0/users/{userId}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    "Authorization: Basic <encoded-value>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Response Codes

Code Description
200 OK
400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
500 Internal Server Error

Example Responses

Successful Response (200)

{
  "id": "<string>",
  "name": "<string>",
  "organisation": "<string>",
  "roles": [],
  "projects": ["<string>"],
  "acceptedTOS": true,
  "disabled": true,
  "_id": "<string>",
  "createdAt": 1694518620,
  "lastChanged": 1694518620,
  "createdBy": "<string>",
  "lastChangedBy": "<string>"
}

Error Response (400)

{
  "type": "Bad Request",
  "title": "Bad Request Error",
  "status": 400,
  "detail": "Validation failed. Missing payload.",
  "instance": "/v2.0/flows/5ce7c2d833ea1e04d7e6c432",
  "code": 1000,
  "traceId": "api--f84324f4-98eb-4f02-abdd-375a2e6c3c1f"
}

Error Response (401)

{
  "type": "Unauthorized",
  "title": "Unauthorized Error",
  "status": 401,
  "detail": "<string>",
  "instance": "/v2.0/flows/5ce7c2d833ea1e04d7e6c432",
  "code": 401,
  "traceId": "api--f84324f4-98eb-4f02-abdd-375a2e6c3c1f"
}

Authorization Header

Authorization: Basic <encoded-value> - Basic Authentication required for this endpoint.

Required Path Parameters

Accepted Headers