# Account User(s)

This action retrieves information about user(s) in your White Swan account. This does not include [Referred Clients](/partner-knowledge-base/zapier-integration/search-actions/referred-client-s.md).

{% hint style="info" %}
A White Swan for partners account allows you an unlimited amount of account users for free and offers permission control functions to manage your team.
{% endhint %}

**API Method:**

## Fetch User(s)

<mark style="color:green;">`POST`</mark> `https://app.whiteswan.io/api/1.1/wf/user`

Returns information about users associated with your White Swan account.

#### Headers

| Name                                            | Type   | Description            |
| ----------------------------------------------- | ------ | ---------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer \<YOUR API KEY> |
| Content-Type<mark style="color:red;">\*</mark>  | String | application/json       |
| Accept<mark style="color:red;">\*</mark>        | String | application/json       |
| user-agent<mark style="color:red;">\*</mark>    | String | \<YOUR APP>            |

#### Request Body

| Name                                        | Type   | Description             |
| ------------------------------------------- | ------ | ----------------------- |
| JSON Body<mark style="color:red;">\*</mark> | Object | See specification below |

{% tabs %}
{% tab title="200: OK Call success" %}

{% endtab %}

{% tab title="400: Bad Request Call failure" %}

{% endtab %}

{% tab title="401: Unauthorized Permission denied" %}

{% endtab %}

{% tab title="404: Not Found Not found" %}

{% endtab %}

{% tab title="405: Method Not Allowed Wrong method" %}

{% endtab %}

{% tab title="429: Too Many Requests Too many requests" %}

{% endtab %}

{% tab title="500: Internal Server Error Internal bug" %}

{% endtab %}

{% tab title="503: Service Unavailable Service unavailable" %}

{% endtab %}
{% endtabs %}

<details>

<summary>Sample Body Payload</summary>

```json
{
"user_email": "jane@gmail.com"
}
```

</details>

{% hint style="info" %}
Please note that the sample body payload above contains all possible parameters for your reference. In an actual call, you don't need to use all (or any) parameters.
{% endhint %}

**Code Examples - Making the API Call:**

{% tabs %}
{% tab title="cURL" %}

```json
curl -X POST "https://app.whiteswan.io/api/1.1/wf/user" \
     -H "Authorization: Bearer <YOUR API KEY>" \
     -H "Content-Type: application/json" \
     -H "Accept: application/json" \
     -H "User-Agent: <YOUR APP>" \
     -d '{
               "user_email": "jane@gmail.com"
          }'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://app.whiteswan.io/api/1.1/wf/user"
headers = {
    "Authorization": "Bearer <YOUR API KEY>",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "User-Agent": "<YOUR APP>"
}

data = {
    "user_email": "jane@gmail.com"
}

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

{% endtab %}

{% tab title="Javascript" %}

```javascript
const url = "https://app.whiteswan.io/api/1.1/wf/user";
const headers = {
    "Authorization": "Bearer <YOUR API KEY>",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "user-agent": "<YOUR APP>"
};
const data = {
    "user_email": "jane@gmail.com"
};

fetch(url, {
    method: "POST",
    headers: headers,
    body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error("Error:", error));
```

{% endtab %}

{% tab title="Java" %}

```java
import okhttp3.*;

public class WhiteSwanApiCall {

    public static void main(String[] args) {
        OkHttpClient client = new OkHttpClient();

        MediaType mediaType = MediaType.parse("application/json");
        RequestBody body = RequestBody.create(mediaType, "{\"user_email\":\"jane@gmail.com\"}");

        Request request = new Request.Builder()
            .url("https://app.whiteswan.io/api/1.1/wf/user")
            .post(body)
            .addHeader("Authorization", "Bearer <YOUR API KEY>")
            .addHeader("Content-Type", "application/json")
            .addHeader("Accept", "application/json")
            .addHeader("user-agent", "<YOUR APP>")
            .build();

        try {
            Response response = client.newCall(request).execute();
            System.out.println(response.body().string());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$ch = curl_init();

$data = array(
    "user_email" => "jane@gmail.com"
);

$headers = array(
    "Authorization: Bearer <YOUR API KEY>",
    "Content-Type: application/json",
    "Accept: application/json",
    "user-agent: <YOUR APP>"
);

curl_setopt($ch, CURLOPT_URL, "https://app.whiteswan.io/api/1.1/wf/user");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require 'net/http'
require 'json'
require 'uri'

uri = URI.parse("https://app.whiteswan.io/api/1.1/wf/user")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

headers = {
  'Authorization' => 'Bearer <YOUR API KEY>',
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'User-Agent' => '<YOUR APP>'
}

data = {
    user_email: "jane@gmail.com"
}

request = Net::HTTP::Post.new(uri.path, headers)
request.body = data.to_json

response = http.request(request)
puts response.body
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"bytes"
	"fmt"
	"net/http"
)

func main() {
	url := "https://app.whiteswan.io/api/1.1/wf/user"
	data := `{
    			"user_email": "jane@gmail.com"
		}`

	req, err := http.NewRequest("POST", url, bytes.NewBuffer([]byte(data)))
	if err != nil {
		panic(err)
	}

	req.Header.Set("Authorization", "Bearer <YOUR API KEY>")
	req.Header.Set("Content-Type", "application/json")
	req.Header.Set("Accept", "application/json")
	req.Header.Set("User-Agent", "<YOUR APP>")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()

	fmt.Println("Response Status:", resp.Status)
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Code examples are available in ***cURL***, ***Python***, ***Javascript***, ***Java***, ***PHP***, ***Ruby***, and ***Go***, but can be constructed for other languages and tools. Some code examples include dependencies that may need to be installed in your codebase to ensure functionality. Remember to replace any values in the code that looks like \<VALUE> and to adapt the parameter values passed.
{% endhint %}

***

**Body Parameters Specification:**

<table data-full-width="true"><thead><tr><th>Field Label</th><th>Field Key</th><th>Field Type</th><th>Example Value</th><th>Description</th></tr></thead><tbody><tr><td>User Email</td><td>user_email</td><td>Text</td><td>john.doe@example.com</td><td>Optionally, you can get a specific user by specifying their email here.</td></tr></tbody></table>

***

<details>

<summary>Sample Return Payload</summary>

```json
[{
"name": "John Doe",
"email": "john.doe@example.com",
"permission": "Admin",
"clients_referred": [
  {
    "name": "Alice Johnson",
    "email": "alice.johnson@example.com",
    "associated_request_ids": [
      "1234567890x0987654321"
    ],
    "associated_plan_ids": [
      "1234567890x1122334455"
    ]
  }
],
"other_partners_referred": [
  {
    "name": "Sample Bank",
    "count_of_requests": 5,
    "count_of_issued_policies": 2
  }
],
"total_amount_credited": 10000
}]
```

</details>

**Returned Parameters Specification:**

<table data-full-width="true"><thead><tr><th>Field Label</th><th>Field Key</th><th>Field Type</th><th>Example Value</th><th>Description</th></tr></thead><tbody><tr><td>User Name</td><td>name</td><td>Text</td><td>John Doe</td><td>The name of the account user.</td></tr><tr><td>User Email</td><td>email</td><td>Text</td><td>john.doe@example.com</td><td>The email address of the account user.</td></tr><tr><td>User Permission Level</td><td>permission</td><td>Text</td><td>Admin</td><td>The permission level assigned to the account user.</td></tr><tr><td>Referred Clients</td><td>clients_referred</td><td>Object List</td><td>-</td><td>Details of clients referred by the account user.</td></tr><tr><td>-Full Name</td><td>name</td><td>Text</td><td>Alice Johnson</td><td>The name of the client referred by the account user.</td></tr><tr><td>-Email</td><td>email</td><td>Text</td><td>alice.johnson@example.com</td><td>The email address of the client referred by the account user.</td></tr><tr><td>-Associated Request(s) ID</td><td>associated_request_ids</td><td>List</td><td>1234567890x0987654321</td><td>The ID of the plan request(s) associated with the referred client.</td></tr><tr><td>-Associated Plan(s) ID</td><td>associated_plan_ids</td><td>List</td><td>1234567890x1122334455</td><td>The ID of the personal plan(s) associated with the referred client.</td></tr><tr><td>Referred Partners</td><td>other_partners_referred</td><td>Object List</td><td>-</td><td>Details of other partners referred by the account user.</td></tr><tr><td>-Partner Name</td><td>name</td><td>Text</td><td>Sample Bank</td><td>The name of other partners referred by the account user.</td></tr><tr><td>-Count of Requests</td><td>count_of_requests</td><td>Number</td><td>5</td><td>The number of requests associated with the other partner referred by the account user.</td></tr><tr><td>-Count of Issued Policies</td><td>count_of_issued_policies</td><td>Number</td><td>2</td><td>The number of issued policies associated with the other partner referred by the account user.</td></tr><tr><td>Total Amount Credited for User Associated Referrals</td><td>total_amount_credited</td><td>Number</td><td>10000</td><td>The total amount credited to the account user for their associated end-user and client referrals.</td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.whiteswan.io/partner-knowledge-base/api-documentation/information-calls/account-user-s.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
