# Update contact PATCH https://app.askelephant.ai/api/v2/contacts/{contact_id} Content-Type: application/json Updates a single workspace contact. Requires the `contacts:write` scope. Reference: https://docs.askelephant.ai/api-reference/contacts/update-contact ## OpenAPI Specification ```yaml openapi: 3.1.0 info: title: AskElephant Public API version: 1.0.0 paths: /v2/contacts/{contact_id}: patch: operationId: update-contact summary: Update contact description: Updates a single workspace contact. Requires the `contacts:write` scope. tags: - subpackage_contacts parameters: - name: contact_id in: path required: true schema: type: string - name: Authorization in: header description: Bearer authentication required: true schema: type: string responses: '200': description: Updated contact response. content: application/json: schema: $ref: '#/components/schemas/contact' '401': description: Authentication is missing or invalid. content: application/json: schema: $ref: '#/components/schemas/error' '403': description: Authenticated but missing required scope. content: application/json: schema: $ref: '#/components/schemas/error' '404': description: The requested resource does not exist. content: application/json: schema: $ref: '#/components/schemas/error' '409': description: The request conflicts with an existing active resource. content: application/json: schema: $ref: '#/components/schemas/error' '422': description: Request body validation failed. content: application/json: schema: $ref: '#/components/schemas/error' '429': description: Too many requests. content: application/json: schema: $ref: '#/components/schemas/error' '500': description: Unexpected server error. content: application/json: schema: $ref: '#/components/schemas/error' requestBody: content: application/json: schema: $ref: '#/components/schemas/contact_update_request' servers: - url: https://app.askelephant.ai/api - url: https://app-staging.askelephant.ai/api components: schemas: ContactUpdateRequestEmailsItems: type: object properties: email: type: string format: email is_primary: type: boolean required: - email title: ContactUpdateRequestEmailsItems ContactUpdateRequestPhoneNumbersItems: type: object properties: phone_number: type: string is_primary: type: boolean required: - phone_number title: ContactUpdateRequestPhoneNumbersItems contact_update_request: type: object properties: first_name: type: - string - 'null' last_name: type: - string - 'null' description: type: - string - 'null' company_id: type: - string - 'null' emails: type: array items: $ref: '#/components/schemas/ContactUpdateRequestEmailsItems' phone_numbers: type: array items: $ref: '#/components/schemas/ContactUpdateRequestPhoneNumbersItems' time_zone: type: - string - 'null' description: Request payload for updating a contact. title: contact_update_request ContactObject: type: string enum: - contact description: Resource discriminator for contact payloads. title: ContactObject resource_ref: type: object properties: id: type: string object: type: string required: - id - object title: resource_ref ContactEmailsItems: type: object properties: email: type: string format: email description: Contact email address. is_primary: type: boolean description: Indicates whether this is the primary email address. required: - email - is_primary title: ContactEmailsItems ContactPhoneNumbersItems: type: object properties: phone_number: type: string description: Contact phone number in the source-system format. is_primary: type: boolean description: Indicates whether this is the primary phone number. required: - phone_number - is_primary title: ContactPhoneNumbersItems crm_association: type: object properties: object_type: type: string description: CRM object type. crm_object_id: type: string description: The record ID in the source CRM system. source: type: string description: CRM source system. required: - object_type - crm_object_id - source title: crm_association contact: type: object properties: object: $ref: '#/components/schemas/ContactObject' description: Resource discriminator for contact payloads. id: type: string description: Stable AskElephant contact identifier. first_name: type: - string - 'null' description: Contact given name. last_name: type: - string - 'null' description: Contact family name. description: type: string description: Free-form contact summary or notes visible through the public API. company: $ref: '#/components/schemas/resource_ref' description: >- Lightweight reference to the contact's associated company when one exists. emails: type: array items: $ref: '#/components/schemas/ContactEmailsItems' description: Email addresses associated with the contact. phone_numbers: type: array items: $ref: '#/components/schemas/ContactPhoneNumbersItems' description: Phone numbers associated with the contact. crm_association: $ref: '#/components/schemas/crm_association' description: >- CRM record linked to this contact. Present when the contact has been matched to a CRM record via integration or API. time_zone: type: string description: IANA time zone identifier for the contact. created_at: type: string format: date-time description: Timestamp when the contact was first created in AskElephant. updated_at: type: string format: date-time description: Timestamp when the contact was most recently updated in AskElephant. required: - object - id - created_at - updated_at description: Public representation of a workspace contact. title: contact error_item: type: object properties: field: type: string description: Request field or parameter associated with the error. code: type: string description: Stable machine-readable error code. message: type: string description: Human-readable explanation of the error. required: - code - message description: Structured validation or field-level error detail. title: error_item error: type: object properties: type: type: string format: uri description: Stable URI identifying the error category. title: type: string description: Short human-readable summary of the error. status: type: integer description: HTTP status code for this error response. detail: type: string description: Human-readable explanation specific to this request. request_id: type: string description: Correlation identifier for support and debugging. errors: type: array items: $ref: '#/components/schemas/error_item' description: Optional field-level validation errors. required: - type - title - status - detail - request_id description: RFC 9457 problem details response returned for client-visible failures. title: error securitySchemes: BearerAuth: type: http scheme: bearer ``` ## SDK Code Examples ```python import requests url = "https://app.askelephant.ai/api/v2/contacts/contact_id" payload = {} headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.patch(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://app.askelephant.ai/api/v2/contacts/contact_id'; const options = { method: 'PATCH', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://app.askelephant.ai/api/v2/contacts/contact_id" payload := strings.NewReader("{}") req, _ := http.NewRequest("PATCH", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://app.askelephant.ai/api/v2/contacts/contact_id") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Patch.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.patch("https://app.askelephant.ai/api/v2/contacts/contact_id") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{}") .asString(); ``` ```php request('PATCH', 'https://app.askelephant.ai/api/v2/contacts/contact_id', [ 'body' => '{}', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://app.askelephant.ai/api/v2/contacts/contact_id"); var request = new RestRequest(Method.PATCH); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = [] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://app.askelephant.ai/api/v2/contacts/contact_id")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "PATCH" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```