# Create New Contact

## Create a New Contact

Fetch a specific contact's data in an inabit organization, according to the contact's ID.

Using this endpoint users can create a new contact in their organization and associate crypto addresses to it.

```graphql
mutation CreateContact($data: ContactCreateInput!) {
  createContact(data: $data) {
    id
    name
    firstName
    lastName
    email
    shouldNotifyTx
    phone
    contactCategory {
      name
    }
    contactCryptoAccounts {
      name
      address
    }
    }
  }
}
```

### **Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

### Body (<mark style="color:orange;">ContactCreateInput</mark> object)

| Name                                                    | Type    | Description                                                                                                                                                   |
| ------------------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| oraganizationId<mark style="color:red;">\*</mark>       | String  | Organization ID                                                                                                                                               |
| contactName<mark style="color:red;">\*</mark>           | String  | Contact Name                                                                                                                                                  |
| firstName                                               | String  | Contact's First Name                                                                                                                                          |
| lastName                                                | String  | Contact's Last Name                                                                                                                                           |
| email                                                   | String  | Contact Email                                                                                                                                                 |
| shouldNotifyTx                                          | Boolean | <p>If true, send emails to this contact</p><p>for every transaction associated</p><p>with the contact's addresses</p><p><em>("walletCryptoAccounts")</em></p> |
| phone                                                   | String  | Phone Number                                                                                                                                                  |
| contactCategory name                                    | String  | Category name from "Categories"                                                                                                                               |
| contactCryptoAccounts<mark style="color:red;">\*</mark> | String  | Name + address per wallet                                                                                                                                     |

Example body:

```json
{
  "data": {
    "organization": {
      "id": "cloh4qk1e0002dn01v9u2rfvc"
    },
    "name": "George Johnson Limited",
    "firstName": "George",
    "lastName": "Johnson",
    "email": "contactemail@example.com",
    "shouldNotifyTx": true,
    "phone": "588080080",
    },
    "contactCategory": {
      "name": "FinancialServices"
    },
    "contactCryptoAccounts": {
      "create": [
        {
          "name": "Contact address TRON",
          "address": "TBNVRZWdb3ofKeEjucKMCdnnRUbmbdmL8H"
        },
        {
          "name": "Contact address ETH",
          "address": "0xeee9db769958a4b75b5b771f7d196569258e114b"
        }
      ]
    }
  }
}
```

### Response

Return values:

| Name                            | Type   | Description                                 |
| ------------------------------- | ------ | ------------------------------------------- |
| id                              | String | Contact ID                                  |
| name                            | String | Contact Name                                |
| id (contactCryptoAccounts)      | String | ID of the created contactCryptoAccount      |
| name (contactCryptoAccounts)    | String | Name of the created contactCryptoAccount    |
| address (contactCryptoAccounts) | String | Address of the created contactCryptoAccount |

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

```javascript
{
  "data": {
    "createContact": {
      "id": "clph5roj900138f01ngzdkzdm",
      "name": "George Johnson Limited",
      "contactCryptoAccounts": [
        {
          "id": "clph5roj900148f010tomaef4",
          "name": "Contact address TRON",
          "address": "TBNVRZWdb3ofKeEjucKMCdnnRUbmbdmL8H",
        },
        {
          "id": "clph5roj900158f01ssdlpu7e",
          "name": "Contact address ETH",
          "address": "0xeee9db769958a4b75b5b771f7d196569258e114b",
        }
      ],
    }
  }
}
```

{% endtab %}

{% tab title="🔴 Failure" %}

{% endtab %}
{% endtabs %}

**How do I retrieve my organization ID?**

In order to retrieve an organization's identifier, you'll need to call your user details first, to understand which organization is related to them.

```graphql
query User($where: UserWhereUniqueInput!) {
  user(where: $where) {
    fullName
    organizations {
      name
      id
    }
  }
}
```

### Try it out!

{% embed url="<https://studio.apollographql.com/sandbox/explorer?endpoint=https://api.inabit.com/graphql&explorerURLState=N4IgJg9gxgrgtgUwHYBcQC4RxighigSwiQAIBhAJwXwTOLyhQAoASMfXdc+3Ry6lAgCSSAA44AhAEoSwADqkSUKjTqpezdni5sOM+YpIkCYBUaNJciM+YBmBCgGcUAOSsIbRgDa5nb64YkCHC4BF6eJI4AFhAwXmAuEIS2AJ4AKgAeEaIxSB6BUDx8NADmEBQpshEW7hEAvhGF6nwVoigQAIJQhTCojlWBNQHm5rhgYFSOjvUzig1IdSAANCAAbrgUBLgARl4IjhggBkZy4BynXMfmp+UluEgEAF74REgXAyMnICbvp1BeECiABYAI4AawAjAgAAywgBMYCQ0IhqwAnDA4RRbKsoKd6ksIqdLNYMCRTgBxBC3BAkABSgKQjmIJAAMgQ4ARBKZloSQPYnK5aqSKVSKCUPDzAqcfH4hVxTvSooziKcCVKQMFQuFhSAmgxBCEwgABBAZKyiPYAOkKcFVvOisXiiWS6SypJQFBgCDVI1OOWIEvlIAArAAOUPQiOR6F2wJ1H3XXVFFBkUrlFLvK6+kDEwNkkAAMQIliQUC2XgAyggKKsCFB9ni4wmvnqNJQUm1Ot1Yn1M9V88oBHmANr9oxZz5fXO-EBqfUkMYTfb9NIAJQA8i5Y5Ps4vJtMdWkAEIuABqq4AWgB1MDbADMEFsAGkEABRABWMCgT4AsmREUgq4AKrbHA2xgHALKhgAEo2O4kPGY4fPB+bTjqc4aAu4z7iQr5pLBkoofme7LjO0IZAglGoreADsABsqKomGuBAtsNHBtsHE0TREK2DRYAQqidHBgxcJhggEIQqxcE7vMk4ALqzEYiwrFE1BgNWByYHiIDLCAogQM4theAQJRRCg66iNWLzEBWygEG0hwgHUQA>" %}
