# Overview


# Basics

Here's how you can authenticate with SmartTask Api

## Authentication Basics

SmartTask supports OAuth2 for authenticating with the API.&#x20;

```
"Authorization: Bearer ACCESS_TOKEN"
```

* We require that authentication happen through OAuth2 authentication flow.

### OAuth

OAuth is now the preferred method of authentication for developers, users and SmartTask as a platform. If you are new to OAuth, learning about it not as scary as you might think!

Here is the [official OAuth spec](http://tools.ietf.org/html/draft-ietf-oauth-v2-31), feel free to take a look at it.&#x20;

OAuth is a mechanism for applications to access SmartTask API on behalf of a user without the application having access to username or password. Instead the application gets a token which they can use to authenticate the Web Api call.

### Register an Application

Before you can use SmartTask OAuth, you need to register your application to obtain a **Client ID** and **Client Secret**.

To create an OAuth application:

1. Sign up for a SmartTask account if you don't already have one.
2. Create an organization in SmartTask.
3. Email [**support@smarttask.io**](mailto:support@smarttask.io) and request that the **Business plan** be activated for your organization so you can create an OAuth application.

Once the Business plan is enabled, you'll be able to create your OAuth application and obtain your Client ID and Client Secret.

You must supply your application with:

* **App Name** - A name for your application. A user will see this name when your application requests permission to access their account as well as when they review the list of apps they have authorized.
* **App URL** - The URL where users can access your application or, in the case of native applications, this can be a link to setup or support instructions. Note that this URL must start with "http" or "https".
* **Redirect URL** - As described in the OAuth specification, this is where the user will be redirected upon successful or failed authentications. Native or command line applications should use the special redirect URL `urn:ietf:wg:oauth:2.0:oob`. For security reasons, non-native applications **must** supply a "https" URL (more on this below).
* **Icon** - Optionally, you can upload an icon to enhance the recognizability of the application when users are authenticating.

Note that all of these attributes can be changed later, so don't worry too much right away.

Once you have created an app, the details view will include a Client ID, needed to uniquely identify your app to the SmartTask API, as well as a Client Secret.

**Note** Your Client Secret is a *secret*, it should never be shared with anyone or checked into source code that others could gain access to.

### OpenID Connect

SmartTask also supports the [OpenID Connect](https://openid.net/connect/) protocol for authenticating SmartTask users with your applications. This means that, in addition to the normal `code` and `token` response types for the OAuth flow, you can also use the `id_token` response type.

For this response type, you are not granted an access token for the API, but rather given a signed [Json Web Token](https://jwt.io/) containing the user's ID along with some metadata. If you want to allow users to log into your services using their SmartTask account, the OpenID Connect protocol is an ideal way to authenticate an SmartTask user. To obtain an ID token, you must request the `openid` scope during the authentication flow.

It is also possible to obtain an ID token alongside an authorization code in the authorization code grant flow by using the (space-delimited) `code id_token` response type. If you do, the redirect parameters will include the ID token in addition to everything you would normally receive.

To access additional information about the user in a standardized format, we also expose a [user info endpoint](https://openid.net/specs/openid-connect-core-1_0.html#UserInfo) that can provide the user's name, email address, and profile photo. This data is available by making a `GET` request to `https://ext-v2.smarttask.io/v1.0/user/current-user` with an OAuth access token. Depending on the scopes tied to that token, you will receive different pieces of data.&#x20;

Metadata about our OpenID Connect implementation is also made available through OpenID Connect's [discovery protocol](https://openid.net/specs/openid-connect-discovery-1_0.html). Making an unauthenticated `GET` request to [`https://identity.smarttask.io/99abc933-fcdd-4dba-893c-b2b9f81c0676/B2C_1A_SIGNUP_SIGNIN/v2.0/.well-known/openid-configuration`](https://identity.smarttask.io/99abc933-fcdd-4dba-893c-b2b9f81c0676/B2C_1A_SIGNUP_SIGNIN/v2.0/.well-known/openid-configuration) will provide all the details of our implementation necessary for you to use OpenID Connect with SmartTask's API.


# Details

## Quick Overview

* You would need to have Client Id and Client Secret handy.&#x20;
* The endpoint for user authorization is <https://identity.smarttask.io/99abc933-fcdd-4dba-893c-b2b9f81c0676/B2C_1A_SIGNUP_SIGNIN/oauth2/v2.0/authorize>
* The endpoint for token exchange is <https://identity.smarttask.io/99abc933-fcdd-4dba-893c-b2b9f81c0676/B2C_1A_SIGNUP_SIGNIN/oauth2/v2.0/token>
* Scope: `openid offline_access https://smarttaskauth.onmicrosoft.com/api/write https://smarttaskauth.onmicrosoft.com/api/read`
* SmartTask supports the Authorization Code Grant flow.
* Once an access token has been obtained your application can make calls on behalf of the user

## User Authorization Endpoint

### **Request**

> Send a user to authorize

```
<a href="https://identity.smarttask.io/99abc933-fcdd-4dba-893c-b2b9f81c0676/B2C_1A_SIGNUP_SIGNIN/oauth2/v2.0/authorize
?client_id=3257234
&redirect_uri=https://my.app.com
&response_type=code
&state=someRandomString
&scope=openid offline_access https://smarttaskauth.onmicrosoft.com/api/write https://smarttaskauth.onmicrosoft.com/api/read">Authenticate with SmartTask</a>
```

Your app redirects the user to <https://identity.smarttask.io/99abc933-fcdd-4dba-893c-b2b9f81c0676/B2C_1A_SIGNUP_SIGNIN/oauth2/v2.0/authorize>, passing parameters along as a standard query string:

| Parameter          | Description                                                                                                                                                      |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **client\_id**     | *required* The Client ID uniquely identifies the application making the request.                                                                                 |
| **redirect\_uri**  | *required* The URI to redirect to on success or error. This *must* match the Redirect URL specified in the application settings.                                 |
| **response\_type** | *required* Must be either `code` or `id_token`, or the space-delimited combination `code id_token`.                                                              |
| **state**          | *optional* Encodes state of the app, which will be returned verbatim in the response and can be used to match the response up to a given request.                |
| **scope**          | *optional* A space-delimited set of one or more scopes to get the user's permission to access. Defaults to the `default` OAuth scope if no scopes are specified. |

### **Response**

If either the `client_id` or `redirect_uri` do not match, the user will simply see a plain-text error. Otherwise, all errors will be sent back to the `redirect_uri` specified.

The user then sees a screen giving them the opportunity to accept or reject the request for authorization. In either case, the user will be redirected back to the `redirect_uri`.

> User is redirected to the redirect\_uri

```
https://my.app.com?code=325797325&state=someRandomString
```

When using the `response_type=code`, your app will receive the following parameters in the query string on successful authorization.

|   | Parameter | Description                                                                               |
| - | --------- | ----------------------------------------------------------------------------------------- |
|   | **code**  | If response\_type=code in the request, this is the code your app can exchange for a token |
|   | **state** | The state parameter that was sent with the authorizing request                            |

You should check that the state is the same in this response as it was in the request.

## OAuth Scopes

The SmartTask API supports a small set of OAuth scopes you can request using the `scope` parameter during the user authorization step of your authentication flow. Multiple scopes can be requested at once as a space-delimited list of scopes. An exhaustive list of the supported scopes is provided here:

| Scope                                                                                                  | Access provided                                                                              |
| ------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------- |
| **openid**                                                                                             | Provides access to OpenID Connect ID tokens and the OpenID Connect user info endpoint.       |
| **offline\_access**                                                                                    | Provides refresh\_token access. Refresh token can be utilize to generate a new access\_token |
| [**https://smarttaskauth.onmicrosoft.com/api/read**](https://smarttaskauth.onmicrosoft.com/api/read)   | Provides read access to api endpoints                                                        |
| [**https://smarttaskauth.onmicrosoft.com/api/write**](https://smarttaskauth.onmicrosoft.com/api/write) | Provides write access to api endpoints                                                       |

## Token Exchange Endpoint

### **Request**

When your app receives a code from the authorization endpoint, it can now be exchanged for a proper token.

If you have a `client_secret`, this request should be sent from your secure server. The browser should never see your `client_secret`.

> App sends request to token

```
{
  "grant_type": "authorization_code",
  "client_id": "3257234",
  "client_secret": "asdaf1234126asfd",
  "redirect_uri": "https://my.app.com",
  "code": "46788432"
}
```

Your app should make a `POST` request to `https://identity.smarttask.io/99abc933-fcdd-4dba-893c-b2b9f81c0676/B2C_1A_SIGNUP_SIGNIN/oauth2/v2.0/token`, passing the parameters as part of a standard form-encoded post body.

| Parameter          | Description                                                                                                                  |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------- |
| **grant\_type**    | *required* One of `authorization_code` or `refresh_token`. See below for more details.                                       |
| **client\_id**     | *required* The Client ID uniquely identifies the application making the request.                                             |
| **client\_secret** | *required* The Client Secret belonging to the app, found in the details pane of the developer console.                       |
| **redirect\_uri**  | *required* Must match the `redirect_uri` specified in the original request.                                                  |
| **code**           | *required* This is the code you are exchanging for an authorization token.                                                   |
| **refresh\_token** | *sometimes required* If `grant_type=refresh_token` this is the refresh token you are using to be granted a new access token. |

The token exchange endpoint is used to exchange a code or refresh token for an access token.

**Response**

In the response, you will receive a JSON payload with the following parameters:

```
{
  "access_token": "fuygh765567jhghdfssd5a",
  "expires_in": 3600,
  "token_type": "bearer",
  "refresh_token": "hjkl325hjkl4325hj4kl32fjds",
}
```

| Parameter          | Description                                                                                              |
| ------------------ | -------------------------------------------------------------------------------------------------------- |
| **access\_token**  | The token to use in future requests against the API                                                      |
| **expires\_in**    | The number of seconds the token is valid, typically 3600 (one hour)                                      |
| **token\_type**    | The type of token, in our case, `bearer`                                                                 |
| **refresh\_token** | If exchanging a code, a long-lived token that can be used to get new access tokens when old ones expire. |

### Decode Access Token

Decoding jwt access\_token you would find following details of the user:

| Parameter       | Description                                                          |
| --------------- | -------------------------------------------------------------------- |
| **email**       | Email Id of the user                                                 |
| **user\_id**    | UserId of the user (You would need to convert the UserId to Integer) |
| **full\_name**  | Fullname of the user                                                 |
| **avatar\_url** | *Nullable* Display picture of the user                               |

#### Authorization Code Grant <a href="#authorization-code-grant" id="authorization-code-grant"></a>

To implement the Authorization Code Grant flow (the most typical flow for most applications), there are three steps:

1. Send the user to the authorization endpoint so that they can approve access of your app.
2. Receive a redirect back from the authorization endpoint with a **code** embedded in the parameters
3. Exchange the code via the token exchange endpoint for a `**refresh_token**` and, for convenience, an initial `access_token`.
4. When the short-lived `access_token` expires, the `**refresh_token**` can be used with the token exchange endpoint, without user intervention, to get a fresh `access_token`.

The access token that you have at the end can be used to make calls to the SmartTask API on the user's behalf.

#### Secure Redirect Endpoint <a href="#secure-redirect-endpoint" id="secure-redirect-endpoint"></a>

As the redirect from the authorization endpoint in either grant procedure contains a code that is secret between SmartTask's authorization servers and your application, this response should not occur in plaintext over an unencrypted `http` connection. We're enforcing the use of `https` redirect endpoints.

For non-production or personal use, you may wish to check out [stunnel](https://www.stunnel.org/index.html), which can act as a proxy to receive an encrypted connection, decrypt it, and forward it on to your application. For development work, you may wish to create a self-signed SSL/TLS certificate for use with your web server; for production work we recommend purchasing a SSL certificate.


# Organization


# Fetch Organizations

## Get Organizations

<mark style="color:blue;">`GET`</mark> `https://ext-v2.smarttask.io/v1.0/organization/list`

This endpoint allows you to get all organizations a user is associated with.

#### Headers

| Name          | Type   | Description                 |
| ------------- | ------ | --------------------------- |
| Authorization | string | Authentication bearer token |

{% tabs %}
{% tab title="200 Organizations successfully retrieved." %}

```
[
    {
        "organization_id": 1,
        "name": "Hitech Pvt Ltd"
    }
]
```

Please refer to [Organization](/models/company) for more on the model received in response
{% endtab %}
{% endtabs %}


# Task


# Create a Task

The task is the basic building block in SmartTask. In the SmartTask application, middle pane is populated with tasks. When a task is selected, it opens up the right hand side detailed pane with selected task's parameters.

## Create a Task

<mark style="color:green;">`POST`</mark> `https://ext-v2.smarttask.io/v{api-version}/task/create-task/{organization_id}`&#x20;

#### Path Parameters

| Name             | Type   | Description                              |
| ---------------- | ------ | ---------------------------------------- |
| api-version      | string | API Version - 1.0                        |
| organization\_id | number | OrganizationId of SmartTask organization |

#### Headers

| Name          | Type   | Description                |
| ------------- | ------ | -------------------------- |
| Authorization | string | Authorization Bearer token |

#### Request Body

* Please refer to [Task](/models/task)

#### Response

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

```
{
    "record_id": "1d6f7da6-45bf-4ef1-a55a-265b30aa2484",
    "organization_id": 38,
    "created_by_user_id": 57,
    "record_type": "task",
    "record_sub_type": "task",
    "access_type": "default",
    "is_template": false,
    "name": "John doe enterprises",
    "description": "<p><strong>Industry:</strong> Technology (Software Development &amp; IT Services)</p><p><strong>Headquarters:</strong> San Francisco, CA, USA</p><h3><strong>Business Objectives:</strong></h3><ul><li><p><strong>Primary Goal:</strong> Increase brand awareness and online presence for their newly launched software product, CloudX.</p></li><li><p><strong>Secondary Goal:</strong> Generate qualified leads for B2B sales and improve customer engagement through digital channels.</p></li></ul><p></p>",
    "parents": [],
    "assigned_user": {
        "email_confirmed": true,
        "role": "core",
        "job_role": null,
        "department": null,
        "about_me": null,
        "status_icon_url": null,
        "status_message": null,
        "status_out_of_office": false,
        "status_clear_at": null,
        "cost_per_hour": 50.0,
        "billable_rate_per_hour": 100.0,
        "capacity": {
            "mon_capacity_in_hours": 8,
            "tue_capacity_in_hours": 8,
            "wed_capacity_in_hours": 8,
            "thu_capacity_in_hours": 8,
            "fri_capacity_in_hours": 8,
            "sat_capacity_in_hours": 0,
            "sun_capacity_in_hours": 0,
            "weekly_capacity_in_hours": 40
        },
        "created_at": "2025-05-01T13:57:03.2503853Z",
        "modified_at": "2025-05-01T13:57:03.2503853Z",
        "user_id": 56,
        "full_name": "Olivia Jones",
        "email": "olivia@acme.io",
        "avatar_url": "https://smartstorage1.blob.core.windows.net/photos/UserPics/5b1f69da-9d5e-404e-b2b9-14f5c2c85bf6.png",
        "timezone_in_mins": null
    },
    "followers": [
        {
            "email_confirmed": true,
            "role": "core",
            "job_role": null,
            "department": null,
            "about_me": null,
            "status_icon_url": null,
            "status_message": null,
            "status_out_of_office": false,
            "status_clear_at": null,
            "cost_per_hour": 50.0,
            "billable_rate_per_hour": 100.0,
            "capacity": {
                "mon_capacity_in_hours": 8,
                "tue_capacity_in_hours": 8,
                "wed_capacity_in_hours": 8,
                "thu_capacity_in_hours": 8,
                "fri_capacity_in_hours": 8,
                "sat_capacity_in_hours": 0,
                "sun_capacity_in_hours": 0,
                "weekly_capacity_in_hours": 40
            },
            "created_at": "2025-05-01T13:57:03.2505218Z",
            "modified_at": "2025-05-01T13:57:03.2505218Z",
            "user_id": 56,
            "full_name": "Olivia Jones",
            "email": "olivia@acme.io",
            "avatar_url": "https://smartstorage1.blob.core.windows.net/photos/UserPics/5b1f69da-9d5e-404e-b2b9-14f5c2c85bf6.png",
            "timezone_in_mins": null
        },
        {
            "email_confirmed": true,
            "role": "core",
            "job_role": null,
            "department": null,
            "about_me": null,
            "status_icon_url": null,
            "status_message": null,
            "status_out_of_office": false,
            "status_clear_at": null,
            "cost_per_hour": 50.0,
            "billable_rate_per_hour": 100.0,
            "capacity": {
                "mon_capacity_in_hours": 8,
                "tue_capacity_in_hours": 8,
                "wed_capacity_in_hours": 8,
                "thu_capacity_in_hours": 8,
                "fri_capacity_in_hours": 8,
                "sat_capacity_in_hours": 0,
                "sun_capacity_in_hours": 0,
                "weekly_capacity_in_hours": 40
            },
            "created_at": "2025-05-01T13:57:03.2505293Z",
            "modified_at": "2025-05-01T13:57:03.2505294Z",
            "user_id": 57,
            "full_name": "Mike Williams",
            "email": "mike@acme.io",
            "avatar_url": "https://smartstorage1.blob.core.windows.net/smarttask/organization/26/0303cfa3-ebce-4928-8e03-df260ec17686/mike.webp",
            "timezone_in_mins": null
        }
    ],
    "custom_field_values": [
        {
            "custom_field_info": {
                "custom_field_id": "1b3e66f3-8fa4-47ca-8034-523665394c61",
                "type": "select",
                "data_type": "select",
                "name": "Qualified Lead",
                "last_custom_id": null,
                "config_editable_by": "everyone",
                "value_editable_by": "everyone",
                "created_at": "2025-05-01T13:57:03.2505709Z",
                "modified_at": "2025-05-01T13:57:03.250571Z"
            },
            "option_value": {
                "option_id": "7b1f4034-ec94-40e4-87db-60aa18987e48",
                "custom_field_id": "1b3e66f3-8fa4-47ca-8034-523665394c61",
                "name": "Yes",
                "color_id": 13,
                "is_enabled": true,
                "order_index": 148.000000000000000,
                "created_at": "2024-11-13T12:47:19.1032711",
                "modified_at": "2024-11-13T12:47:19.1032745"
            },
            "multi_select_option_values": [],
            "created_at": "2025-05-01T13:57:03.2505412Z",
            "modified_at": "0001-01-01T00:00:00",
            "cfv_id": 438511,
            "project_id": null,
            "record_id": "1d6f7da6-45bf-4ef1-a55a-265b30aa2484",
            "custom_field_id": "1b3e66f3-8fa4-47ca-8034-523665394c61",
            "text_value": null,
            "number_value": null,
            "option_id": "7b1f4034-ec94-40e4-87db-60aa18987e48",
            "option_multiple_ids": [],
            "datetime_value": null
        },
        {
            "custom_field_info": {
                "custom_field_id": "ce04759b-604b-44cb-95e9-e62846ad66fc",
                "type": "select",
                "data_type": "select",
                "name": "Service Interested",
                "last_custom_id": null,
                "missing_dependency": false,
                "config_editable_by": "everyone",
                "value_editable_by": "everyone",
                "created_at": "2025-05-01T13:57:03.2506153Z",
                "modified_at": "2025-05-01T13:57:03.2506153Z"
            },
            "option_value": {
                "option_id": "bb5730ce-7227-4ea7-bbcf-41bd10a8e026",
                "custom_field_id": "ce04759b-604b-44cb-95e9-e62846ad66fc",
                "name": "Social media management",
                "color_id": 12,
                "is_enabled": true,
                "order_index": 926.000000000000000,
                "created_at": "2024-11-13T12:51:10.218605",
                "modified_at": "2024-11-13T12:51:10.218617"
            },
            "multi_select_option_values": [],
            "created_at": "2025-05-01T13:57:03.2506124Z",
            "modified_at": "0001-01-01T00:00:00",
            "cfv_id": 438520,
            "project_id": null,
            "record_id": "1d6f7da6-45bf-4ef1-a55a-265b30aa2484",
            "custom_field_id": "ce04759b-604b-44cb-95e9-e62846ad66fc",
            "text_value": null,
            "number_value": null,
            "option_id": "bb5730ce-7227-4ea7-bbcf-41bd10a8e026",
            "option_multiple_ids": [],
            "datetime_value": null
        },
        {
            "custom_field_info": {
                "custom_field_id": "3b22221d-188b-4761-a27f-39cb24e2b7c6",
                "type": "select",
                "data_type": "select",
                "name": "Request Type",
                "last_custom_id": null,
                "missing_dependency": false,
                "config_editable_by": "everyone",
                "value_editable_by": "everyone",
                "created_at": "2025-05-01T13:57:03.2506294Z",
                "modified_at": "2025-05-01T13:57:03.2506295Z"
            },
            "option_value": {
                "option_id": "ae2fa8fe-7abb-4fd1-98f7-b744e40df3eb",
                "custom_field_id": "3b22221d-188b-4761-a27f-39cb24e2b7c6",
                "name": "Organization",
                "color_id": 10,
                "is_enabled": true,
                "order_index": 165.000000000000000,
                "created_at": "2024-11-14T06:32:31.4777778",
                "modified_at": "2024-11-14T06:36:51.1292097"
            },
            "multi_select_option_values": [],
            "created_at": "2025-05-01T13:57:03.2506271Z",
            "modified_at": "0001-01-01T00:00:00",
            "cfv_id": 439307,
            "project_id": null,
            "record_id": "1d6f7da6-45bf-4ef1-a55a-265b30aa2484",
            "custom_field_id": "3b22221d-188b-4761-a27f-39cb24e2b7c6",
            "text_value": null,
            "number_value": null,
            "option_id": "ae2fa8fe-7abb-4fd1-98f7-b744e40df3eb",
            "option_multiple_ids": [],
            "datetime_value": null
        },
        {
            "custom_field_info": {
                "custom_field_id": "07b35e2c-8d9a-4233-9139-56940d8e0316",
                "type": "select",
                "data_type": "select",
                "name": "Status",
                "last_custom_id": null,
                "missing_dependency": false,
                "config_editable_by": "everyone",
                "value_editable_by": "everyone",
                "created_at": "2025-05-01T13:57:03.2506428Z",
                "modified_at": "2025-05-01T13:57:03.2506429Z"
            },
            "option_value": {
                "option_id": "59fd631c-7527-4a2b-925e-43f2a927e2fd",
                "custom_field_id": "07b35e2c-8d9a-4233-9139-56940d8e0316",
                "name": "Not started",
                "color_id": 3,
                "is_enabled": true,
                "order_index": 1.000000000000000,
                "created_at": "2024-11-08T06:53:30.551784",
                "modified_at": "2025-03-26T12:32:56.4482762"
            },
            "multi_select_option_values": [],
            "created_at": "2025-05-01T13:57:03.2506405Z",
            "modified_at": "0001-01-01T00:00:00",
            "cfv_id": 439314,
            "project_id": null,
            "record_id": "1d6f7da6-45bf-4ef1-a55a-265b30aa2484",
            "custom_field_id": "07b35e2c-8d9a-4233-9139-56940d8e0316",
            "text_value": null,
            "number_value": null,
            "option_id": "59fd631c-7527-4a2b-925e-43f2a927e2fd",
            "option_multiple_ids": [],
            "datetime_value": null
        },
        {
            "custom_field_info": {
                "custom_field_id": "d97545d8-837b-4971-bcd6-63f6834cd826",
                "type": "select",
                "data_type": "select",
                "name": "Region",
                "last_custom_id": null,
                "missing_dependency": false,
                "config_editable_by": "everyone",
                "value_editable_by": "everyone",
                "created_at": "2025-05-01T13:57:03.2506579Z",
                "modified_at": "2025-05-01T13:57:03.250658Z"
            },
            "option_value": null,
            "multi_select_option_values": [],
            "created_at": "2025-05-01T13:57:03.2506556Z",
            "modified_at": "0001-01-01T00:00:00",
            "cfv_id": 668534,
            "project_id": null,
            "record_id": "1d6f7da6-45bf-4ef1-a55a-265b30aa2484",
            "custom_field_id": "d97545d8-837b-4971-bcd6-63f6834cd826",
            "text_value": null,
            "number_value": null,
            "option_id": null,
            "option_multiple_ids": [],
            "datetime_value": null
        },
        {
            "custom_field_info": {
                "custom_field_id": "d1564388-eac1-4ab2-8d9f-45aabaea684e",
                "type": "select",
                "data_type": "select",
                "name": "Lead Source",
                "last_custom_id": null,
                "missing_dependency": false,
                "config_editable_by": "everyone",
                "value_editable_by": "everyone",
                "created_at": "2025-05-01T13:57:03.2506669Z",
                "modified_at": "2025-05-01T13:57:03.2506669Z"
            },
            "option_value": null,
            "multi_select_option_values": [],
            "created_at": "2025-05-01T13:57:03.2506648Z",
            "modified_at": "0001-01-01T00:00:00",
            "cfv_id": 3243924,
            "project_id": null,
            "record_id": "1d6f7da6-45bf-4ef1-a55a-265b30aa2484",
            "custom_field_id": "d1564388-eac1-4ab2-8d9f-45aabaea684e",
            "text_value": null,
            "number_value": null,
            "option_id": null,
            "option_multiple_ids": [],
            "datetime_value": null
        },
        {
            "custom_field_info": {
                "custom_field_id": "67aa8914-ef12-4f58-b1ac-add2208afa49",
                "type": "select",
                "data_type": "select",
                "name": "Demo Done",
                "last_custom_id": null,
                "missing_dependency": false,
                "config_editable_by": "everyone",
                "value_editable_by": "everyone",
                "created_at": "2025-05-01T13:57:03.2506756Z",
                "modified_at": "2025-05-01T13:57:03.2506756Z"
            },
            "option_value": null,
            "multi_select_option_values": [],
            "created_at": "2025-05-01T13:57:03.2506734Z",
            "modified_at": "0001-01-01T00:00:00",
            "cfv_id": 3243925,
            "project_id": null,
            "record_id": "1d6f7da6-45bf-4ef1-a55a-265b30aa2484",
            "custom_field_id": "67aa8914-ef12-4f58-b1ac-add2208afa49",
            "text_value": null,
            "number_value": null,
            "option_id": null,
            "option_multiple_ids": [],
            "datetime_value": null
        },
        {
            "custom_field_info": {
                "custom_field_id": "9cbefca1-61dd-488b-969e-bcb347b47e47",
                "type": "select",
                "data_type": "select",
                "name": "Deal Stage",
                "last_custom_id": null,
                "missing_dependency": false,
                "config_editable_by": "everyone",
                "value_editable_by": "everyone",
                "created_at": "2025-05-01T13:57:03.2506849Z",
                "modified_at": "2025-05-01T13:57:03.2506849Z"
            },
            "option_value": {
                "option_id": "0c0f54c0-bc85-4f00-800f-33f8a9858f86",
                "custom_field_id": "9cbefca1-61dd-488b-969e-bcb347b47e47",
                "name": "Deal Won",
                "color_id": 7,
                "is_enabled": true,
                "order_index": 898.000000000000000,
                "created_at": "2024-11-13T12:39:29.0288334",
                "modified_at": "2025-04-09T19:41:54.5213358"
            },
            "multi_select_option_values": [],
            "created_at": "2025-05-01T13:57:03.2506826Z",
            "modified_at": "0001-01-01T00:00:00",
            "cfv_id": 3243926,
            "project_id": null,
            "record_id": "1d6f7da6-45bf-4ef1-a55a-265b30aa2484",
            "custom_field_id": "9cbefca1-61dd-488b-969e-bcb347b47e47",
            "text_value": null,
            "number_value": null,
            "option_id": "0c0f54c0-bc85-4f00-800f-33f8a9858f86",
            "option_multiple_ids": [],
            "datetime_value": null
        },
        {
            "custom_field_info": {
                "custom_field_id": "3413b8d2-b80c-4a35-b286-c51f4be85a2e",
                "type": "select",
                "data_type": "select",
                "name": "Vertical",
                "last_custom_id": null,
                "missing_dependency": false,
                "config_editable_by": "everyone",
                "value_editable_by": "everyone",
                "created_at": "2025-05-01T13:57:03.2507002Z",
                "modified_at": "2025-05-01T13:57:03.2507002Z"
            },
            "option_value": null,
            "multi_select_option_values": [],
            "created_at": "2025-05-01T13:57:03.250698Z",
            "modified_at": "0001-01-01T00:00:00",
            "cfv_id": 3243927,
            "project_id": null,
            "record_id": "1d6f7da6-45bf-4ef1-a55a-265b30aa2484",
            "custom_field_id": "3413b8d2-b80c-4a35-b286-c51f4be85a2e",
            "text_value": null,
            "number_value": null,
            "option_id": null,
            "option_multiple_ids": [],
            "datetime_value": null
        },
        {
            "custom_field_info": {
                "custom_field_id": "2865eca7-ad10-41d9-abb2-f75cecfd344a",
                "type": "number",
                "data_type": "number",
                "name": "Payment Value",
                "last_custom_id": null,
                "missing_dependency": false,
                "config_editable_by": "everyone",
                "value_editable_by": "everyone",
                "created_at": "2025-05-01T13:57:03.2507099Z",
                "modified_at": "2025-05-01T13:57:03.25071Z"
            },
            "option_value": null,
            "multi_select_option_values": [],
            "created_at": "2025-05-01T13:57:03.2507075Z",
            "modified_at": "0001-01-01T00:00:00",
            "cfv_id": 3243928,
            "project_id": null,
            "record_id": "1d6f7da6-45bf-4ef1-a55a-265b30aa2484",
            "custom_field_id": "2865eca7-ad10-41d9-abb2-f75cecfd344a",
            "text_value": null,
            "number_value": 15000.00000,
            "option_id": null,
            "option_multiple_ids": [],
            "datetime_value": null
        }
    ],
    "reminders": [],
    "priority": "high",
    "date_info": {
        "start_date": "2024-11-05T18:30:00",
        "due_date": "2024-11-06T18:29:00",
        "duration": 1,
        "recurr_type": "never_repeat",
        "recurr_on": "on_completion",
        "recurr_interval": 1,
        "recurr_weekdays": [],
        "recurr_day_of_month": 1,
        "recurr_on_start_date": null,
        "recurring_record_created": false
    },
    "planned_start": null,
    "planned_due": null,
    "status": 1,
    "status_modified_at": "2025-04-23T08:30:24.836",
    "completed_at": "2025-04-23T08:30:24.836",
    "estimated_time": 233,
    "actual_time": null,
    "billable": true,
    "cost": null,
    "billable_amount": null,
    "parent": null,
    "member_role": "edit",
    "archived": false,
    "projects": [
        {
            "inherited": false,
            "group_id": 124,
            "project_id": "2b928aec-ca9c-4ed3-80c5-24523c2f7b8e",
            "parent_project_id": null,
            "name": "Deals",
            "data_type": "task",
            "access_type": "public_to_parent",
            "default_view_id": "c555b969-5e01-46f7-a477-032acbdaaa62",
            "start_date": null,
            "due_date": null,
            "icon_url": "https://v2.smarttask.io/assets/images/common/svg/icons/8.svg",
            "color_id": 15,
            "order_index": 9.500000000000000,
            "owner_user_id": 57,
            "status": null,
            "is_template": false,
            "t_record_dates_from": null,
            "archived": false,
            "is_delete_triggered": false,
            "created_at": "2024-11-08T06:26:10.473"
        }
    ],
    "files": [],
    "dependencies": [],
    
    "contacts": [
        {
            "record_id": "173b2b1c-8738-4d50-8f3b-51aad190014e",
            "record_sub_type": "person",
            "name": "John",
            "avatar_url": null,
            "parent_name": null,
            "designation": null,
            "archived": false
        }
    ],
    "contact_email": null,
    "contact_phone": null,
    "created_at": "2024-11-13T12:31:07.367",
    "modified_at": "2025-04-23T13:02:15.703",
}
```

{% endtab %}
{% endtabs %}


# Complete a Task

## Complete a Task

<mark style="color:green;">`GET`</mark> `https://ext-v2.smarttask.io/v{api-version}/task/update-status/{organization_id}/{record_id}/{status}`&#x20;

#### Path Parameters

| Name             | Type   | Description                              |
| ---------------- | ------ | ---------------------------------------- |
| api-version      | string | API Version - 1.0                        |
| organization\_id | number | OrganizationId of SmartTask organization |
| record\_id       | uuid   | RecordId                                 |
| status           | bit    | 1 - complete , 0 - incomplete            |

#### Headers

| Name          | Type   | Description                |
| ------------- | ------ | -------------------------- |
| Authorization | string | Authorization Bearer token |

#### Request Body

* Not needed

#### Response

{% tabs %}
{% tab title="200 " %}
Ok
{% endtab %}
{% endtabs %}


# Contact


# Create a Contact

## Create a Contact

<mark style="color:green;">`POST`</mark> `https://ext-v2.smarttask.io/v{api-version}/contact/create/{organization_id}`&#x20;

#### Path Parameters

| Name             | Type   | Description                              |
| ---------------- | ------ | ---------------------------------------- |
| api-version      | string | API Version - 1.0                        |
| organization\_id | number | OrganizationId of SmartTask organization |

#### Query Parameters

| Name         | Type    | Description                                                                                           |
| ------------ | ------- | ----------------------------------------------------------------------------------------------------- |
| use\_created | boolean | `true` - check if there is a similar contact if so, return the same instead of creating a new contact |

#### Headers

| Name          | Type   | Description                |
| ------------- | ------ | -------------------------- |
| Authorization | string | Authorization Bearer token |

#### Request Body

* Please refer to [Contact](/models/contact)

#### Response

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

```
{
    "custom_field_values": [],
    "description": "",
    "assigned_user": null,
    "followers": [
        {
            "email_confirmed": true,
            "role": "core",
            "job_role": null,
            "department": null,
            "about_me": null,
            "status_icon_url": null,
            "status_message": null,
            "status_out_of_office": false,
            "status_clear_at": null,
            "cost_per_hour": 50,
            "billable_rate_per_hour": 100,
            "capacity": {
                "mon_capacity_in_hours": 8,
                "tue_capacity_in_hours": 8,
                "wed_capacity_in_hours": 8,
                "thu_capacity_in_hours": 8,
                "fri_capacity_in_hours": 8,
                "sat_capacity_in_hours": 0,
                "sun_capacity_in_hours": 0,
                "weekly_capacity_in_hours": 40
            },
            "created_at": "2025-05-23T09:47:19.1655819Z",
            "modified_at": "2025-05-23T09:47:19.1655819Z",
            "user_id": 57,
            "full_name": "Mike Williams",
            "email": "mike@acme.io",
            "avatar_url": "https://smartstorage1.blob.core.windows.net/smarttask/organization/26/0303cfa3-ebce-4928-8e03-df260ec17686/mike.webp",
            "timezone_in_mins": null
        },
        {
            "email_confirmed": true,
            "role": "core",
            "job_role": null,
            "department": null,
            "about_me": null,
            "status_icon_url": null,
            "status_message": null,
            "status_out_of_office": false,
            "status_clear_at": null,
            "cost_per_hour": 50,
            "billable_rate_per_hour": 100,
            "capacity": {
                "mon_capacity_in_hours": 8,
                "tue_capacity_in_hours": 8,
                "wed_capacity_in_hours": 8,
                "thu_capacity_in_hours": 8,
                "fri_capacity_in_hours": 8,
                "sat_capacity_in_hours": 0,
                "sun_capacity_in_hours": 0,
                "weekly_capacity_in_hours": 40
            },
            "created_at": "2025-05-23T09:47:19.1656262Z",
            "modified_at": "2025-05-23T09:47:19.1656263Z",
            "user_id": 59,
            "full_name": "John",
            "email": "john@acme.io",
            "avatar_url": "https://smartstorage1.blob.core.windows.net/photos/UserPics/ec53bc94-1d43-438a-bb12-24eccdce600f.png",
            "timezone_in_mins": null
        }
    ],
    "record_id": "d46a122c-0bb3-4a7a-8c27-2138d3d3ab06",
    "organization_id": 38,
    "created_by_user_id": 59,
    "record_type": "contact",
    "record_sub_type": "person",
    "access_type": "default",
    "name": "Alex Johnson",
    "designation": null,
    "avatar_url": null,
    "assigned_user_id": null,
    "parent": {
        "record_id": "a7b85d7e-7da2-462d-8b45-aefdcebc4efd",
        "record_sub_type": "organization",
        "name": "Coca - Cola",
        "avatar_url": null,
        "parent_name": null,
        "designation": null,
        "archived": false
    },
    "address": null,
    "address_lat": null,
    "address_lng": null,
    "emails": [
        {
            "email": "alex.johnson@examplemail.com"
        }
    ],
    "phones": [
        {
            "phone_number": "+15551234567"
        }
    ],
    "url_details": {
        "domain": null,
        "twitter_url": null,
        "linkedin_url": null,
        "facebook_url": null,
        "github_url": null,
        "instagram_url": null
    },
    "projects": [],
    "files": [],
    "archived": false,
    "created_at": "2024-11-21T13:43:02.472",
    "modified_at": "2025-05-23T09:46:54.64"
}
```

{% endtab %}
{% endtabs %}


# Record Activity


# Fetch Activities

## Fetch Activities

<mark style="color:green;">`POST`</mark> `https://ext-v2.smarttask.io/v{api-version}/record-activity/activities/{organization_id}/{record_id}?list_size={list_size}`&#x20;

#### Path Parameters

| Name             | Type          | Description                              |
| ---------------- | ------------- | ---------------------------------------- |
| api-version      | string        | API Version - 1.0                        |
| organization\_id | number        | OrganizationId of SmartTask organization |
| record\_id       | string (uuid) | Contact Id or Task Id                    |

#### Query Params

| Name       | Type                      | Description                          |
| ---------- | ------------------------- | ------------------------------------ |
| list\_size | number                    | Size of the list to return (Max 100) |
| before\_id | \[Optional] string (uuid) | Activity Id                          |
| after\_id  | \[Optional] string (uuid) | Activity Id                          |

#### Headers

| Name          | Type   | Description                |
| ------------- | ------ | -------------------------- |
| Authorization | string | Authorization Bearer token |

#### Request Body

* Array of ActivityTypeEnum
* Eg: `["comment", "call", "file" ]`

#### Response

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

```
{
    "list": [
        {
            "activity_id": "b0069a84-d564-45bf-a690-fd29596730f4",
            "record_id": "a6e0e94e-c49c-4117-b72f-2a98f253eeb0",
            "created_by_user": {
                "user_id": 55,
                "full_name": "Elma Rogers",
                "email": "elma@acme.io",
                "avatar_url": "https://smartstorage1.blob.core.windows.net/photos/UserPics/4e93314b-cab6-44d4-911d-b03247cccac8.png",
                "timezone_in_mins": 330
            },
            "type": "comment",
            "access_type": "default",
            "contact_id": null,
            "contact": null,
            "task_id": null,
            "task": null,
            "text": "<p>Was unable to connect with the client </p>",
            "from_text": null,
            "to_text": null,
            "reaction_summaries": [],
            "created_at": "2024-11-21T10:59:56.633",
            "modified_at": "2024-11-21T10:59:56.633"
        }
    ],
    "limit_reached": true
}
```

{% endtab %}
{% endtabs %}


# Add Comment

## Add Comment

<mark style="color:green;">`POST`</mark> `https://ext-v2.smarttask.io/v{api-version}/record-activity/comment/{organization_id}` &#x20;

This endpoint add a new comment on a task

#### Path Parameters

| Name             | Type   | Description                        |
| ---------------- | ------ | ---------------------------------- |
| organization\_id | number | OrganizationId of the organization |
| api-version      | string | Api Version (Right now its 1.0)    |

#### Headers

| Name          | Type   | Description         |
| ------------- | ------ | ------------------- |
| Authorization | string | Bearer Access Token |

#### Request Body

* Please refer to [Record Activity](/models/record-activity)

{% tabs %}
{% tab title="200 Added Successfully" %}

```
```

{% endtab %}
{% endtabs %}


# Project


# Fetch Projects

## Fetch Projects

<mark style="color:blue;">`POST`</mark> `https://ext-v2.smarttask.io/v{api-version}/project/list/{organization_id}/{archive_flag}?group_id={group_id}&query={query}&page_no={page_no}&list_size={list_size}&is_template={is_template}`

#### Path Parameters

| Name             | Type   | Description                        |
| ---------------- | ------ | ---------------------------------- |
| api-version      | string | API Version is 1.0                 |
| organization\_id | string | OrganizationId of the organization |

#### Query Parameters

| Name         | Type    | Description                                                                                                  |
| ------------ | ------- | ------------------------------------------------------------------------------------------------------------ |
| group\_id    | number  | To fetch projects under a particular group                                                                   |
| query        | string  | The API will do its best to find projects matching the query                                                 |
| is\_template | boolean | <p>True - if you only want to fetch templates<br>False - If you only want to fetch non-template projects</p> |
| page\_no     | number  | Page number                                                                                                  |
| list\_size   | number  | Can't be bigger than 100                                                                                     |

#### Headers

| Name          | Type   | Description         |
| ------------- | ------ | ------------------- |
| Authorization | string | Bearer Access Token |

#### Request Body

* Array of except\_project\_ids
* Eg: \["550e8400-e29b-41d4-a716-446655440000"]

#### Response

{% tabs %}
{% tab title="200 Success" %}

```
[
    {
        ProjectId: "f81d4fae-7dec-11d0-a765-00a0c91e6bf6",
        Name: "Marina"
    },
    {
        ProjectId: "550e8400-e29b-41d4-a716-446655440000",
        Name: "CasaOne"
    }    
]

```

{% endtab %}

{% tab title="404 In case organization\_id does not exist" %}

```
{    "message": "NotFound"}
```

{% endtab %}
{% endtabs %}


# Organization User


# Filter Users

## Filter Users

<mark style="color:blue;">`POST`</mark> `https://ext-v2.smarttask.io/v1.0/organization-user/filter-users/{organization_id}?query={query}&page_no={page_no}&list_size={list_size}`

#### Path Parameters

| Name             | Type   | Description                        |
| ---------------- | ------ | ---------------------------------- |
| organization\_id | number | OrganizationId to fetch users from |

#### Query Parameters

| Name       | Type   | Description                                                                 |
| ---------- | ------ | --------------------------------------------------------------------------- |
| query      | string | The API will do its best to find a user matching the provided query string. |
| page\_no   | number | Page Number                                                                 |
| list\_size | number | Cannot be greater than 100                                                  |

#### Headers

| Name          | Type   | Description  |
| ------------- | ------ | ------------ |
| Authorization | string | Bearer token |

#### Request Body

* Array of except\_user\_ids
* Eg: \[ 1, 2]

#### Response Body

{% tabs %}
{% tab title="200 Users successfully retrieved." %}

```
[
    {
        full_name: "Alex Macmohan";
        email: "alex@awesome.com";
        user_id: 1;
        role: "core";
        avatar_url: "https://someurl.png";
    }
]

```

{% endtab %}
{% endtabs %}


# Webhooks


# Subscribe to an Event

<mark style="color:green;">`POST`</mark> `https://ext-v2.smarttask.io/v{api_version}/webhook/subscribe/{your_app_name}`

#### Path Parameters

| Name            | Type   | Description     |
| --------------- | ------ | --------------- |
| your\_app\_name | string | Your App's name |
| api\_version    | string | 1.0             |

#### Headers

| Name           | Type   | Description         |
| -------------- | ------ | ------------------- |
| Authentication | string | Bearer Access Token |

#### Request Body

* Please refer to [Webhook](/models/webhook)
* Please confirm the required fields for different type of events

{% tabs %}
{% tab title="201 Webhook Accepted. Returns WebhookId which you can utilize for un-subscription from the webhook" %}

```
{id: 12551}
```

{% endtab %}

{% tab title="404 We don't accept such an event name" %}

```
```

{% endtab %}
{% endtabs %}


# Unsubscribe from a Webhook

Unsubscribe from the webhook

## Unsubscribe

<mark style="color:red;">`DELETE`</mark> `https://ext-v2.smarttask.io/v{api_version}/webhook/unsubscribe/{webhook_id}`

This endpoint allows unsubscribe from the Webhook

#### Path Parameters

| Name         | Type   | Description                    |
| ------------ | ------ | ------------------------------ |
| api\_version | string | Api Version = v1.0             |
| webhook\_id  | number | Webhook Id to unsubscribe from |

#### Headers

| Name           | Type   | Description  |
| -------------- | ------ | ------------ |
| Authentication | string | Bearer Token |

{% tabs %}
{% tab title="200 Unsubscribed successfully" %}

```
{    }
```

{% endtab %}

{% tab title="404 Could not find the webhook" %}

```
{}
```

{% endtab %}
{% endtabs %}


# Organization

### Organization Model

```json
{
    organization_id: number;
    name: string; //Max 50 char
    timezone: {
        timezone_region: string;
        timezone_in_mins: number;
    },
    associated_domain?: string;
    icon_url?: string; 
}
```


# Organization User

```
{
    email_confirmed: boolean;
    role: OrganizationUserRoleEnum;

    job_role?: string;  //50 char
    department?: string; //50 char
    about_me?: string;   //150 char

    status_icon_url?: string;    //2000 char
    status_message?: string;      //100 char
    status_out_of_office = false;
    status_clear_at?: Date;

    cost_per_hour: number;
    billable_rate_per_hour: number;

    capacity = new CapacityModel();

    created_at: Date;
    modified_at: Date;
}
```

### OrganizationUserRoleEnum

```
{
    admin = 'admin',
    core = 'core',
    guest_user = 'guest_user',
}

```

### CapacityModel

```json
{
    mon_capacity_in_hours: number = 8;
    tue_capacity_in_hours: number = 8;
    wed_capacity_in_hours: number = 8;
    thu_capacity_in_hours: number = 8;
    fri_capacity_in_hours: number = 0;
    sat_capacity_in_hours: number = 0;
    sun_capacity_in_hours: number = 0;
    weekly_capacity_in_hours: number = 40;
}
```


# Group

```json
{
    group_id: number;
    name: string; // maxLength 100

    access_type: MembershipAccessTypeEnum = MembershipAccessTypeEnum.public_to_parent;

    order_index: number = 0;
}
```

Please refer to [Membership](/models/membership) for MembershipAccessTypeEnum.


# Project

```json
{
    group_id?: number;
    project_id?: string;

    parent_project_id?: string;

    name: string; // max 100, min 1

    access_type: MembershipAccessTypeEnum = MembershipAccessTypeEnum.public_to_parent;

    default_view_id?: string;

    start_date?: Date;
    due_date?: Date;

    icon_url: string;
    color_id: number: number; //Between 0 to 16 number

    order_index: number = 0;

    owner_user_id?: number;

    status?: ProjectStatusEnum;

    is_template = false;

    archived = false;
    is_delete_triggered = false;

    created_at: Date;
}

```

Please refer to [Membership](/models/membership) for MembershipAccessTypeEnum

### ProjectStatusEnum

```json
{
    on_track = 'on_track',
    at_risk = 'at_risk',
    off_track = 'off_track',
    on_hold = 'on_hold',
    completed = 'completed'
}
```

### ProjectRecordModel

```typescript
export class ProjectRecordModel extends ProjectBaseModel{
    inherited = false;

    constructor(){
        super();
    }
}
```


# Record

### RecordIdNameModel

```typescript
{
    record_id: string;
    name?: string;
}

```

### RecordDependencyModel

```typescript
{
    record_id_blocked : string;
    record_blocking = {
        record_id: string;
        name?: string;
        status?: RecordStatusEnum;
    }
}
```

### RecordStatusEnum

```typescript
{
    incomplete = 0,
    complete
}
```

### RecordAccessTypeEnum

```typescript
{
    default = "default",
    core_members = "core_members"
}
```


# Record Activity

### RecordActivityModel

<pre class="language-typescript"><code class="lang-typescript"><strong>{
</strong>    activity_id: string;        //UUID
    record_id: string;          //UUID
    created_by_user: UserModel;

    type: RecordActivityTypeEnum = RecordActivityTypeEnum.created;
    
    access_type: RecordAccessTypeEnum = RecordAccessTypeEnum.default;

    contact_id?: string;        //UUID
    contact?: RecordIdNameModel;

    task_id?: string;            //UUID
    task?: RecordIdNameModel;

    reaction_summaries: RecordActivityReactionSummaryModel[] = [];
    
    created_at: Date = new Date();
    modified_at: Date = new Date();
}
</code></pre>

#### RecordActivityTypeEnum

```typescript
export enum RecordActivityTypeEnum
{
    comment = "comment",
    call = "call",
    task_attached = "task_attached",

    assignee = "assignee",
    archive = "archive",
    contact_attached = "contact_attached",
    created = "created",
    custom_field = "custom_field",
    start_date = "start_date",
    due_date = "due_date",
    date_type = "date_type",
    date_interval = "date_interval",
    dependency = "dependency",
    description = "description",
    estimate = "estimate",
    file = "file",
    followers = "followers",
    name = "name",
    parent = "parent",
    priority = "priority",
    projects = "projects",
    record_type = "record_type",
    record_sub_type = "record_sub_type",
    status = "status",
    timeline = "timeline",                  //Utilized when timeline is shifted

}
```

#### RecordAccessTypeEnum

* Please refer to [Record](/models/record)


# Task

### TaskModel

```typescript
{
    record_id?: string;

    organization_id: number;
    created_by_user_id: number;
    
    record_sub_type = RecordSubTypeEnum.task;
    access_type = RecordAccessTypeEnum.default;
    is_template = false;

    name?: string;
    description?: string;
    
    assigned_user?: OrganizationUserModel;

    priority?: RecordPriorityEnum;

    date_info: RecordDateModel = new RecordDateModel();

    planned_start?: Date;
    planned_due?: Date;

    status = RecordStatusEnum.incomplete;
    status_modified_at?: Date;
    completed_at?: Date;

    estimated_time?: number;
    actual_time?: number;
    billable: boolean = true;
    cost?: number;
    billable_amount?: number;

    parent?: RecordIdNameModel;

    member_role = MembershipRoleEnum.edit;      //Can only be edit / view

    sub_records_unarchived_count: number;
    sub_records_archived_count: number;

    archived = false;

    projects = new Array<ProjectRecordModel>();

    followers = new Array<OrganizationUserModel>();

    files = new Array<FileModel>(); 

    dependencies = new Array<RecordDependencyModel>();

    contacts = new Array<ContactTypeaheadModel>();
    contact_email?: string; //To link contact while import
    contact_phone?: string; //To link contact while import

    custom_field_values = new Array<CustomFieldValueModel>();

    created_at: Date;
    modified_at: Date;
}
```

### TaskSubType

* Defines the type of record this is - task or milestone

```typescript
{
    task = 'task',
    milestone = 'milestone',
}
```

### RecordAccessTypeEnum

* If its \`core\_members\` it means this task is only visible to internal members and not to the guest user

```typescript
{
    default = "default",
    core_members = "core_members"
}
```

### PriorityEnum

```typescript
{
    high = 'high',
    medium = 'medium',
    low = 'low',
}

```

### DateModel

```typescript
{
    start_date?: Date;
    due_date?: Date;
    duration?: number; //In days

    recurr_type: RecurrTypeEnum = RecurrTypeEnum.never_repeat;
    recurr_on: RecurrOnEnum = RecurrOnEnum.on_completion;
    recurr_interval = 1; 
    recurr_weekdays = new Array<DayOfWeek>(); 
    recurr_day_of_month = 1;
}
```

#### RecurrTypeEnum

```typescript
{
    never_repeat = 'never_repeat',
    days = 'days',
    weeks = 'weeks',
    months = 'months',
    years = 'years',
}
```

#### RecurrOnEnum

```typescript
{
    on_completion = "on_completion",
    on_schedule = "on_schedule"
}
```

### More Details

* For ProjectRecordModel please refer to [Project](/models/project)
* For FileModel please refer to [File](/models/file)
* For RecordStatusEnum please refer to [Record](/models/record)
* For OrganizationUserModel please refer to [Organization User](/models/company/companyuser)


# Contact

## Contact Model

```typescript
{
    record_id?: string;
    organization_id: number;
    created_by_user_id: number;

    record_sub_type? = RecordSubTypeEnum.person;

    access_type = RecordAccessTypeEnum.default;

    name: string; // Max length 100
    designation?: string; // Max length 50
    avatar_url?: string;

    assigned_user?: UserModel;

    parent?: ContactTypeaheadModel;

    address?: string;       //4000 chars
    address_lat?: number;
    address_lng?: number;

    emails: ContactEmailModel[] = [];
    phones: ContactPhoneModel[] = [];

    url_details?: ContactUrlModel;

    projects: ProjectRecordModel[] = [];

    followers = new Array<OrganizationUserModel>();

    files: FileModel[] = [];

    custom_field_values: CustomFieldValueModel[] = [];

    archived: boolean = false;

    created_at: Date;
    modified_at: Date;
}
```

#### RecordSubTypeEnum

```typescript
{
    organization = 'organization',
    person = 'person',
}
```

#### ContactEmailModel

```typescript
{
    record_id: string;
    email: string; // Max length 320
}
```

#### ContactPhoneModel

```typescript
{
    record_id: string;
    phone_number: string; // Max length 30
}
```

#### ContactUrlModel

```typescript
{
    domain?: string;
    twitter_url?: string;
    linkedin_url?: string;
    facebook_url?: string;
    github_url?: string;
    instagram_url?: string;
} 
```

#### ContactTypeaheadModel

```typescript
{
    record_id: string;
    record_sub_type: string;
    name: string;
    avatar_url?: string;
    parent_name?: string;
    designation?: string;
    archived: boolean;
}
```

#### More Information

* For RecordAccessTypeEnum please refer to [Record](/models/record)
* For OrganizationUserModel please refer to [Organization User](/models/company/companyuser)
* For ProjectRecordModel please refer to [Project](/models/project#projectrecordmodel)
* For FileModel please refer to [File](/models/file)
* For CustomFieldValueModel please refer to [Custom Field Value](/models/custom-field/custom-field-value)


# Webhook

```typescript
{
  webhook_id?:        number | null;      // DB id (nullable)
  target_url:         string;             // required
  event_type:         WebhookTypeEnum;    // required – see enum below

  organization_id?:   number | null;
  project_id?:        string | null;      // GUID-as-string
  custom_field_id?:   string | null;      // GUID-as-string
}
```

## WebhookType Enum

```typescript

{
    contact_created = "contact_created",    //Requires organization_id
    contact_custom_field_value_updated = "contact_custom_field_value_updated",    //Requires organization_id, custom_field_id
        
    project_custom_field_updated = "project_custom_field_updated",    //Requires organization_id, custom_field_id
        
    task_project_added = "task_project_added",    //Requires organization_id, project_id
    task_custom_field_value_updated = "task_custom_field_value_updated",    //Requires organization_id, project_id, custom_field_id
    task_commented = "task_commented",    //Requires organization_id, project_id
    task_completed = "task_completed",    //Requires organization_id, project_id
    task_reminder = "task_reminder",    //Triggers on reminder date - Requires organization_id, project_id
}
```


# Membership

### MembershipAccessTypeEnum

```json
{
    public_to_anyone = 'public_to_anyone', //Currently only utilized for project
    public_to_parent = 'public_to_parent',
    closed = 'closed', //Currently only utilized for group
    private = 'private',
}
```

### MembershipRoleEnum

```typescript
{
    admin = "admin",
    edit = "edit",
    comment = "comment",
    view = "view"
}
```


# File

```typescript
{
    file_id: number;
    name: string; //Max 255
    file_url: string; //Max 4000
    icon_url: string; //Max 4000
    thumbnail_url?: string; //Max 4000
    content_type: string = "text/plain";
    host: string;
    created_at: Date;

    chat_message_id?: string;
    discussion_id?: string;
    discussion_activity_id?: string;
    form_id?: string;
    record_id?: string;
}

```


# Custom Field

### CustomFieldModel

```typescript
{
    custom_field_id?: string;

    type: CustomFieldTypeEnum = CustomFieldTypeEnum.text;
    data_type : CustomFieldDataTypeEnum = CustomFieldDataTypeEnum.text;

    name: string; // Max 100, Min 1
    
    options: CutomFieldOptionModel[];

    config_editable_by = CustomFieldEditableByEnum.everyone;
    value_editable_by = CustomFieldEditableByEnum.everyone;
    
    created_at: Date;
    modified_at: Date;
}
```

### CustomFieldTypeEnum

```typescript
{
    text = 'text',
    number = "number",
    select = "select",
    datetime = "datetime",
    multi_select = "multi_select",
    formula = "formula",
    custom_id = "custom_id"
}

```

### CustomFieldDataTypeEnum

```typescript
{
    text = 'text',
    number = 'number',
    datetime = 'datetime',
    select = 'select',
    multi_select = 'multi_select',
}
```

### CustomFieldEditableByEnum

```typescript
{
    everyone = 'everyone',
    admin = 'admin',
    no_one = 'no_one',
}

```

### CustomFieldOptionModel

```typescript
{
    option_id?: string;

    custom_field_id: string;

    name: string; // max length 100, min length 1

    color_id: number; //From 0 to 15

    is_enabled = true;
    order_index?: number = 0;

    created_at: Date;
    modified_at?: Date;
}
```


# Custom Field Value

```typescript
{
    cfv_id?: number;
    custom_field_info: CustomFieldModel;
    
    project_id?: string;
    record_id?: string;
    custom_field_id: string;

    text_value?: string; // max 500
    number_value?: number;
    option_value?: CustomFieldOptionModel;
    multi_select_option_values = new Array<CustomFieldOptionModel>();
    datetime_value?: Date;
}
```

* Please refer to [Custom Field](/models/custom-field) for CustomFieldModel, CustomFieldOptionModel


# User

### User Model

```typescript
{
    user_id: number;
    full_name: string;      //100 char
    email: string;
    avatar_url?: string;     //2000 char
    timezone_in_mins?: number;   
}
```


