# Create or Update Contact

## Create new contact

> Create a new or update contact in the system. To update existing contact, provide the user\_id or the same email & firstname, or phone & firstname. In addition to the attributes listed below, you can add any custom attributes to the contact.

```json
{"openapi":"3.0.0","info":{"title":"Gleantap External API","version":"1.0.0"},"tags":[{"name":"Contacts","description":"Contacts"}],"servers":[{"url":"https://api.gleantap.com","description":"Production server"}],"paths":{"/v2/ExternalApi/newContact":{"post":{"tags":["Contacts"],"summary":"Create new contact","description":"Create a new or update contact in the system. To update existing contact, provide the user_id or the same email & firstname, or phone & firstname. In addition to the attributes listed below, you can add any custom attributes to the contact.","operationId":"aecf2e930433a1ee55c7ca351a4647d3","parameters":[{"name":"X-API-KEY","in":"header","description":"Your API key","required":true,"schema":{"type":"string"}},{"name":"X-SECRET-KEY","in":"header","description":"Your Secret key","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["app_id","first_name","last_name"],"properties":{"app_id":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"email":{"type":"string","format":"email"},"phone":{"type":"string"},"address":{"type":"string"},"city":{"type":"string"},"state":{"type":"string"},"zip":{"type":"string"},"source":{"type":"string"},"user_id":{"type":"string"},"dob":{"description":"YYYY-MM-DD","type":"string","format":"date"},"created_date":{"description":"YYYY-MM-DD HH:MM:SS","type":"string","format":"date-time"},"gender":{"type":"string"},"type":{"description":"eg. member, past, prospect","type":"string"},"status":{"description":"eg. active, inactive, non-member etc","type":"string"},"location":{"type":"string"},"optin_sms":{"type":"boolean"},"optout_email":{"type":"boolean"},"tags":{"description":"comma separated tags","type":"string"},"tag_action":{"description":"add or remove","type":"string"}},"type":"object"}}}},"responses":{"200":{"description":"Contact created successfully","content":{"application/json":{"schema":{"properties":{"status":{"type":"string"},"_id":{"type":"string"}},"type":"object"}}}},"400":{"description":"Invalid request"}}}}}}
```


---

# Agent Instructions: 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:

```
GET https://developers.gleantap.com/update-data/create-or-update-contact.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
