# Contacts

Contacts management

## Create or update a contact

> Creates or updates a contact using a \*\*client-owned identifier\*\*.\
> The \`contact.id\` field is mandatory and represents the identifier used by the client system.\
> Optional fields (email, phone, language, name, etc.) will update the existing contact if provided.\
> Additional properties are treated as custom fields.<br>

```json
{"openapi":"3.0.3","info":{"title":"Pristo Public API","version":"1.0.0"},"tags":[{"name":"Contacts","description":"Contacts management"}],"servers":[{"url":"https://api.pristo.io","description":"Production"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-Key","description":"API key (UUID)"}},"parameters":{"populationId":{"name":"populationId","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Population identifier (UUID)"},"requestIdHeader":{"name":"X-Request-Id","in":"header","required":false,"schema":{"type":"string","format":"uuid"},"description":"Optional request correlation ID"}},"schemas":{"ContactUpsertRequest":{"type":"object","required":["contact"],"properties":{"contact":{"$ref":"#/components/schemas/Contact"}}},"Contact":{"type":"object","required":["id"],"properties":{"id":{"type":"string","format":"uuid","description":"Client-owned contact identifier"},"email":{"type":"string","format":"email"},"phone":{"type":"string"},"language":{"type":"string","description":"ISO 639-1 language code (e.g. en, he)"},"name":{"type":"string"},"lastName":{"type":"string"},"customFields":{"type":"object","description":"Dynamic contact fields (string values). Keys must match fields defined on the population.","additionalProperties":{"type":"string","maxLength":255}}},"additionalProperties":false},"ContactResponse":{"type":"object","properties":{"contact":{"$ref":"#/components/schemas/Contact"}}},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}}}}}},"headers":{"requestId":{"schema":{"type":"string","format":"uuid"},"description":"Request correlation ID"}},"responses":{"BadRequest":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Unauthorized":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"RateLimited":{"description":"Too many requests","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"ServerError":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/v1/contacts/save/{populationId}":{"post":{"tags":["Contacts"],"summary":"Create or update a contact","description":"Creates or updates a contact using a **client-owned identifier**.\nThe `contact.id` field is mandatory and represents the identifier used by the client system.\nOptional fields (email, phone, language, name, etc.) will update the existing contact if provided.\nAdditional properties are treated as custom fields.\n","operationId":"upsertContact","parameters":[{"$ref":"#/components/parameters/populationId"},{"$ref":"#/components/parameters/requestIdHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactUpsertRequest"}}}},"responses":{"200":{"description":"Contact updated","headers":{"X-Request-Id":{"$ref":"#/components/headers/requestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactResponse"}}}},"201":{"description":"Contact created","headers":{"X-Request-Id":{"$ref":"#/components/headers/requestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}}}}}}
```
