> For the complete documentation index, see [llms.txt](https://docs.holder.xyz/holder-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.holder.xyz/holder-api/contacts/adding-a-contact.md).

# Adding a Contact

You can manually add a new contact based on a wallet address, email, or phone number.

`POST /contacts`

### Body

| Field             | Type                                        | Description                                 |
| ----------------- | ------------------------------------------- | ------------------------------------------- |
| primaryIdentifier | 'email' \| 'phoneNumber' \| 'walletAddress' | The primary identifier for the new contact. |
| value             | string                                      | The value of the primary identifier.        |

### Response

| CODE | Description                                                                                                             |
| ---- | ----------------------------------------------------------------------------------------------------------------------- |
| 200  | A contact with that identifier already existed so it returns [the existing contact](#contact-object).                   |
| 201  | A new contact was created with the primary identifier and it returns [the new contact](#contact-object).                |
| 400  | The data passed in was invalid. It returns an [error object](#error-object) with with the error message for each field. |
| 500  | Internal Sever Error                                                                                                    |

#### Contact Object

```typescript
{
  id: string;
  createdAt: number;
  updatedAt: number;
  email?: string;
  twitterHandle?: string;
  discordUsername?: string;
  phoneNumber?: string;
  birthday?: number;
  smsOptOut?: boolean;
  agreementTimestamp?: number;
  agreedToAds?: boolean;
}
```

#### Error Object

```typescript
{
    primaryIdentifier?: string;
    value?: string;
}
```

<pre class="language-json"><code class="lang-json">
<strong>// Example 200 Response
</strong><strong>
</strong>{
    "id": "f2790129-2ad0-4fd8-a8d9-5ac85c07705d", // &#x3C;- existing contact id
    "createdAt": "1667482286769",
    "updatedAt": "1667482286769",
    "email": "email@holder.xyz"
}
<strong>
</strong>// Example 201 Response

{
    "id": "234845e8-1dc6-4902-a384-8788516bdd8b", // &#x3C;- new contact id
    "createdAt": "1667482286769",
    "updatedAt": "1667482286769",
    "phoneNumber": "+13175551234"
}
<strong>
</strong><strong>// Example 400 Response
</strong><strong>
</strong>{
    "primaryIdentifier": "Primary identifier must be one of these: email, phoneNumber, or walletAddress",
    "value": "A value for the primary identifier is required."
}


</code></pre>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.holder.xyz/holder-api/contacts/adding-a-contact.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
