# End User (/data-api/api-reference/end-user)

Manage end users in your Fiskil application.



An End User represents your user in the Fiskil platform. End users are used for linking accounts and accessing data. You'll need to create an end user before they can authorize access to their accounts.

Endpoints [#endpoints]

| Method   | Endpoint             | Description           |
| -------- | -------------------- | --------------------- |
| `GET`    | `/v1/end-users`      | Get end user by email |
| `POST`   | `/v1/end-users`      | Create a new end user |
| `DELETE` | `/v1/end-users/{id}` | Delete an end user    |
| `GET`    | `/v1/end-users/{id}` | Get end user by ID    |

The End User Model [#the-end-user-model]

| Attribute | Type   | Required | Description                                                                        |
| --------- | ------ | -------- | ---------------------------------------------------------------------------------- |
| `id`      | string | Yes      | A unique identifier for the End User object                                        |
| `email`   | string | No       | The end user's email address. Used for notifying the end user about their consents |
| `name`    | string | No       | The end user's name                                                                |
| `phone`   | string | No       | The end user's phone number. Used for notifying the end user about their consents  |

Example Response [#example-response]

```json
{
  "id": "482c0e2b-5866-46b1-b795-220b7bba45b5",
  "email": "john_starmer@gmail.com",
  "name": "John Starmer",
  "phone": "+614123456789"
}
```

Get End User by Email [#get-end-user-by-email]

Retrieve an end user using their email address.

```
GET https://api.fiskil.com/v1/end-users
```

Query Parameters [#query-parameters]

| Parameter | Type   | Required | Description                          |
| --------- | ------ | -------- | ------------------------------------ |
| `email`   | string | No       | Email address to filter end users by |

Example Request [#example-request]

<Tabs items={['cURL', 'Node.js', 'Python']}>
  <Tab value="cURL">
    ```bash
    curl --request GET \
      --url 'https://api.fiskil.com/v1/end-users?email=john@example.com' \
      --header 'Authorization: Bearer {access_token}' \
      --header 'accept: application/json; charset=UTF-8'
    ```
  </Tab>

  <Tab value="Node.js">
    ```javascript
    const response = await fetch(
      'https://api.fiskil.com/v1/end-users?email=john@example.com',
      {
        method: 'GET',
        headers: {
          'Authorization': 'Bearer {access_token}',
          'accept': 'application/json; charset=UTF-8'
        }
      }
    );

    const endUsers = await response.json();
    ```
  </Tab>

  <Tab value="Python">
    ```python
    import requests

    response = requests.get(
        'https://api.fiskil.com/v1/end-users',
        params={'email': 'john@example.com'},
        headers={
            'Authorization': 'Bearer {access_token}',
            'accept': 'application/json; charset=UTF-8'
        }
    )

    end_users = response.json()
    ```
  </Tab>
</Tabs>

Example Response [#example-response-1]

```json
[
  {
    "id": "482c0e2b-5866-46b1-b795-220b7bba45b5",
    "email": "john@example.com",
    "name": "John Starmer",
    "phone": "+614123456789"
  }
]
```

Add End User [#add-end-user]

Create a new end user for linking accounts.

```
POST https://api.fiskil.com/v1/end-users
```

Request Body [#request-body]

| Parameter | Type   | Required | Description                                                 |
| --------- | ------ | -------- | ----------------------------------------------------------- |
| `email`   | string | No       | The end user's email address                                |
| `name`    | string | No       | The end user's name                                         |
| `phone`   | string | No       | The end user's phone number in E.164 format                 |
| `abn`     | string | No       | Australian Business Number (ABN) if representing a business |

Example Request [#example-request-1]

<Tabs items={['cURL', 'Node.js', 'Python']}>
  <Tab value="cURL">
    ```bash
    curl --request POST \
      --url https://api.fiskil.com/v1/end-users \
      --header 'Authorization: Bearer {access_token}' \
      --header 'accept: application/json; charset=UTF-8' \
      --header 'content-type: application/json; charset=UTF-8' \
      --data '{
        "email": "john@example.com",
        "name": "John Doe",
        "phone": "+614123456789"
      }'
    ```
  </Tab>

  <Tab value="Node.js">
    ```javascript
    const response = await fetch('https://api.fiskil.com/v1/end-users', {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer {access_token}',
        'accept': 'application/json; charset=UTF-8',
        'content-type': 'application/json; charset=UTF-8'
      },
      body: JSON.stringify({
        email: 'john@example.com',
        name: 'John Doe',
        phone: '+614123456789'
      })
    });

    const result = await response.json();
    console.log(result.end_user_id);
    ```
  </Tab>

  <Tab value="Python">
    ```python
    import requests

    response = requests.post(
        'https://api.fiskil.com/v1/end-users',
        headers={
            'Authorization': 'Bearer {access_token}',
            'accept': 'application/json; charset=UTF-8',
            'content-type': 'application/json; charset=UTF-8'
        },
        json={
            'email': 'john@example.com',
            'name': 'John Doe',
            'phone': '+614123456789'
        }
    )

    result = response.json()
    print(result['end_user_id'])
    ```
  </Tab>
</Tabs>

Example Response [#example-response-2]

```json
{
  "end_user_id": "83064af3-bb81-4514-a6d4-afba340825cd"
}
```

<Callout type="info">
  Store the `end_user_id` securely—you'll need it to create auth sessions and access data for this user.
</Callout>

Delete End User [#delete-end-user]

Delete an existing end user. This will also revoke all associated consents.

```
DELETE https://api.fiskil.com/v1/end-users/{id}
```

Path Parameters [#path-parameters]

| Parameter | Type   | Required | Description                      |
| --------- | ------ | -------- | -------------------------------- |
| `id`      | string | Yes      | The ID of the end user to delete |

Example Request [#example-request-2]

<Tabs items={['cURL', 'Node.js', 'Python']}>
  <Tab value="cURL">
    ```bash
    curl --request DELETE \
      --url https://api.fiskil.com/v1/end-users/482c0e2b-5866-46b1-b795-220b7bba45b5 \
      --header 'Authorization: Bearer {access_token}' \
      --header 'accept: application/json; charset=UTF-8'
    ```
  </Tab>

  <Tab value="Node.js">
    ```javascript
    const response = await fetch(
      'https://api.fiskil.com/v1/end-users/482c0e2b-5866-46b1-b795-220b7bba45b5',
      {
        method: 'DELETE',
        headers: {
          'Authorization': 'Bearer {access_token}',
          'accept': 'application/json; charset=UTF-8'
        }
      }
    );
    ```
  </Tab>

  <Tab value="Python">
    ```python
    import requests

    response = requests.delete(
        'https://api.fiskil.com/v1/end-users/482c0e2b-5866-46b1-b795-220b7bba45b5',
        headers={
            'Authorization': 'Bearer {access_token}',
            'accept': 'application/json; charset=UTF-8'
        }
    )
    ```
  </Tab>
</Tabs>

<Callout type="warning">
  Deleting an end user is permanent and will revoke all associated consents. This action cannot be undone.
</Callout>

Get End User by ID [#get-end-user-by-id]

Retrieve an end user by their ID.

```
GET https://api.fiskil.com/v1/end-users/{id}
```

Path Parameters [#path-parameters-1]

| Parameter | Type   | Required | Description                     |
| --------- | ------ | -------- | ------------------------------- |
| `id`      | string | Yes      | The ID of the end user to fetch |

Example Request [#example-request-3]

<Tabs items={['cURL', 'Node.js', 'Python']}>
  <Tab value="cURL">
    ```bash
    curl --request GET \
      --url https://api.fiskil.com/v1/end-users/482c0e2b-5866-46b1-b795-220b7bba45b5 \
      --header 'Authorization: Bearer {access_token}' \
      --header 'accept: application/json; charset=UTF-8'
    ```
  </Tab>

  <Tab value="Node.js">
    ```javascript
    const response = await fetch(
      'https://api.fiskil.com/v1/end-users/482c0e2b-5866-46b1-b795-220b7bba45b5',
      {
        method: 'GET',
        headers: {
          'Authorization': 'Bearer {access_token}',
          'accept': 'application/json; charset=UTF-8'
        }
      }
    );

    const endUser = await response.json();
    ```
  </Tab>

  <Tab value="Python">
    ```python
    import requests

    response = requests.get(
        'https://api.fiskil.com/v1/end-users/482c0e2b-5866-46b1-b795-220b7bba45b5',
        headers={
            'Authorization': 'Bearer {access_token}',
            'accept': 'application/json; charset=UTF-8'
        }
    )

    end_user = response.json()
    ```
  </Tab>
</Tabs>

Example Response [#example-response-3]

```json
{
  "id": "482c0e2b-5866-46b1-b795-220b7bba45b5",
  "email": "john_starmer@gmail.com",
  "name": "John Starmer",
  "phone": "+614123456789"
}
```
