> For the complete documentation index, see [llms.txt](https://kasplo.gitbook.io/kasplo-doc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kasplo.gitbook.io/kasplo-doc/channels/email-marketing/add-contact-api.md).

# Add Contact API

### Endpoint:

```
POST {domain}/audience/v1/{sid}/contact
    
```

### Sample CURL:

```

      curl --location '{domain}/audience/v1/{sid}/contact' \
--header 'api-key: {api-key}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "update_subscribers": true,
    "data": [
        {
            "email": "test@kasplo.com",
            "first_name": "John",
            "last_name": "Doe",
            "custom_fields": {
                "city": "Bangalore",
                "age": "25"
            }
        }
    ],
    "list_id": "229dc5317d78a2ab45ac641a5a4de156",
    "tags": ["314dc5317d78a2ab45ac641aas4de156"]
}'  
  
```

### Request Fields:

* **update\_subscribers:** If true, updates existing contacts\ <br>
* **data:** Array of contact objects\ <br>
  * **email:** (Required) Unique email ID\ <br>
  * **first\_name, last\_name**\ <br>
  * **custom\_fields:** Key-value pairs\ <br>
* **list\_id:** List ID to which the contact should be added\ <br>
* **tags:** Tag IDs to associate with the contact

### Response:

```

       "total_valid": 1,
        "valid_contacts": [
            {
                "first_name": "Avi",
                "last_name": "S",
                "email": "avinash+api1@kasplo.com",
                "custom_fields": {
                    "city": "Mysore",
                    "age": "27"
                }
            }
        ]
    },
    "error": {}
}

  
```

### Response Fields:

* **valid\_contacts:** Successfully created or updated contacts<br>
* **invalid\_contacts:** Failed contacts with reason<br>
* **total\_valid / total\_invalid:** Count summary
