> For the complete documentation index, see [llms.txt](https://www.docpartner.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.docpartner.dev/en/api/sms-partner/contact-management/add-contact.md).

# Add Contact

This request is used to create a contact within a group

## URL

<mark style="color:green;">`POST`</mark> `https://api.smspartner.fr/v1/contact/add`

#### **Required Parameters**

<table data-full-width="false"><thead><tr><th width="180">Name</th><th>Value</th></tr></thead><tbody><tr><td><code>apiKey</code></td><td><a href="https://my.smspartner.fr/dashboard/api">Your API key</a></td></tr><tr><td><code>groupId</code></td><td>The ID of the group to which the contact will be added</td></tr><tr><td><code>phoneNumber</code></td><td><p>Contact phone number.<br>It must be:</p><ul><li>In national format (06xxxxxxxx) or international format (+336xxxxxxxx) for French numbers</li><li>In international format (+496xxxxxxxx) for numbers outside France</li></ul></td></tr></tbody></table>

#### **Optional Parameters**

<table><thead><tr><th width="262">Name</th><th>Value</th></tr></thead><tbody><tr><td><code>firstname</code></td><td>First name (max 32 characters)</td></tr><tr><td><code>lastname</code></td><td>Last name (max 32 characters)</td></tr><tr><td><code>date</code></td><td>Date in YYYY-MM-DD format. Can be used for automatic sending (e.g., birthday)</td></tr><tr><td><code>url</code></td><td>URL, must start with http:// or https://</td></tr><tr><td><code>custom1</code></td><td>Custom field 1</td></tr><tr><td><code>custom2</code></td><td>Custom field 2</td></tr><tr><td><code>custom3</code></td><td>Custom field 3</td></tr><tr><td><code>custom4</code></td><td>Custom field 4</td></tr></tbody></table>

#### Request

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

```json
{
  "curl_command": {
    "method": "POST",
    "url": "http://api.smspartner.fr/v1/contact/add",
    "headers": {
      "Content-Type": "application/json"
    },
    "data": {
      "apiKey": "YOUR_API_KEY",
      "groupId": "ID GROUP",
      "contact": {
        "phoneNumber": "xxxxxxxxx",
        "firstname": "prénom",
        "lastname": "nom",
        "date": "YYYY-MM-DD",
        "shortUrlPartnr": "http://",
        "url": "http://",
        "custom1": "custom 1",
        "custom2": "custom 2",
        "custom3": "custom 3",
        "custom4": "custom 4"
      }
    }
  }
}
```

{% endtab %}
{% endtabs %}

#### **Response**

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

```json
{
  "success": true,
  "code": 200,
  "contact": {
    "phoneNumber": "xxxxxxxx",
    "firstname": "FirstName",
    "lastname": "LastName",
    "date": "YYYY-MM-DD",
    "shortUrlPartnr": "http://",
    "url": "http://",
    "custom1": "custom 1",
    "custom2": "custom 2",
    "custom3": "custom 3",
    "custom4": "custom 4",
    "contactId": "CONTACT_ID"
  }
}
```

{% endtab %}
{% endtabs %}

#### Errors

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

```json
{
  "success": false,
  "code": 10,
  "message": "Invalid API key"
}
```

{% endtab %}
{% endtabs %}

**Error Codes**

| Response Code | Message                                      |
| ------------- | -------------------------------------------- |
| 1             | groupId is required                          |
| 2             | Contact information is required              |
| 10            | API key is required                          |
| 15            | The phone number already exists in the group |


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.docpartner.dev/en/api/sms-partner/contact-management/add-contact.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
