const response = await fetch('https://api.emailit.com/v2/contacts/con_2BxFg7KNqr5M', {
method: 'POST',
headers: {
'Authorization': 'Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type': 'application/json'
},
body: JSON.stringify({
first_name: 'Jane',
last_name: 'Smith',
custom_fields: { company: 'NewCorp' }
})
});
const result = await response.json();
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://api.emailit.com/v2/contacts/con_2BxFg7KNqr5M',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode([
'first_name' => 'Jane',
'last_name' => 'Smith',
'custom_fields' => ['company' => 'NewCorp']
]),
CURLOPT_HTTPHEADER => [
'Authorization: Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type: application/json'
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "Error cURL #:" . $err;
} else {
$result = json_decode($response, true);
print_r($result);
}
import requests
response = requests.post(
'https://api.emailit.com/v2/contacts/con_2BxFg7KNqr5M',
headers={
'Authorization': 'Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type': 'application/json'
},
json={
'first_name': 'Jane',
'last_name': 'Smith',
'custom_fields': {'company': 'NewCorp'}
}
)
result = response.json()
print(result)
require 'net/http'
require 'json'
uri = URI('https://api.emailit.com/v2/contacts/con_2BxFg7KNqr5M')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Authorization'] = 'Bearer em_test_51RxCWJ...vS00p61e0qRE'
request['Content-Type'] = 'application/json'
request.body = {
first_name: 'Jane',
last_name: 'Smith',
custom_fields: { company: 'NewCorp' }
}.to_json
response = http.request(request)
result = JSON.parse(response.body)
puts result
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
url := "https://api.emailit.com/v2/contacts/con_2BxFg7KNqr5M"
data := map[string]interface{}{
"first_name": "Jane",
"last_name": "Smith",
"custom_fields": map[string]string{"company": "NewCorp"},
}
jsonData, _ := json.Marshal(data)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", "Bearer em_test_51RxCWJ...vS00p61e0qRE")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result)
}
use reqwest;
use serde_json::{json, Value};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let response = client
.post("https://api.emailit.com/v2/contacts/con_2BxFg7KNqr5M")
.header("Authorization", "Bearer em_test_51RxCWJ...vS00p61e0qRE")
.header("Content-Type", "application/json")
.json(&json!({
"first_name": "Jane",
"last_name": "Smith",
"custom_fields": {"company": "NewCorp"}
}))
.send()
.await?;
let result: Value = response.json().await?;
println!("{:?}", result);
Ok(())
}
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
import java.net.http.HttpRequest.BodyPublishers;
public class UpdateContact {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
String jsonBody = "{\"first_name\":\"Jane\",\"last_name\":\"Smith\",\"custom_fields\":{\"company\":\"NewCorp\"}}";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.emailit.com/v2/contacts/con_2BxFg7KNqr5M"))
.header("Authorization", "Bearer em_test_51RxCWJ...vS00p61e0qRE")
.header("Content-Type", "application/json")
.POST(BodyPublishers.ofString(jsonBody))
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
public class UpdateContact
{
public static async Task Main()
{
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Authorization",
"Bearer em_test_51RxCWJ...vS00p61e0qRE");
var data = new {
first_name = "Jane",
last_name = "Smith",
custom_fields = new { company = "NewCorp" }
};
var json = JsonConvert.SerializeObject(data);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.PostAsync(
"https://api.emailit.com/v2/contacts/con_2BxFg7KNqr5M", content);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
}
curl -X POST https://api.emailit.com/v2/contacts/con_2BxFg7KNqr5M \
-H "Authorization: Bearer em_test_51RxCWJ...vS00p61e0qRE" \
-H "Content-Type: application/json" \
-d '{
"first_name": "Jane",
"last_name": "Smith",
"custom_fields": { "company": "NewCorp" }
}'
Actualizar contacto
const response = await fetch('https://api.emailit.com/v2/contacts/con_2BxFg7KNqr5M', {
method: 'POST',
headers: {
'Authorization': 'Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type': 'application/json'
},
body: JSON.stringify({
first_name: 'Jane',
last_name: 'Smith',
custom_fields: { company: 'NewCorp' }
})
});
const result = await response.json();
{
"object": "contact",
"id": "con_2BxFg7KNqr5M...",
"email": "john@example.com",
"first_name": "Jane",
"last_name": "Smith",
"custom_fields": { "company": "NewCorp" },
"unsubscribed": false,
"audiences": [
{
"id": "aud_xxx",
"name": "Newsletter",
"subscriber": {
"id": "sub_xxx",
"subscribed": true,
"subscribed_at": "2026-02-10T10:00:00.000000+00:00",
"unsubscribed_at": null,
"created_at": "2026-02-10T10:00:00.000000+00:00",
"updated_at": "2026-02-10T10:00:00.000000+00:00"
}
}
],
"created_at": "2026-02-10T10:00:00.000000+00:00",
"updated_at": "2026-02-12T09:00:00.000000+00:00"
}
{
"error": "Contacto no encontrado"
}
{
"error": "Ya existe un contacto con este correo electrónico",
"existing": {
"object": "contact",
"id": "con_...",
"email": "..."
}
}
Respuestas
{
"object": "contact",
"id": "con_2BxFg7KNqr5M...",
"email": "john@example.com",
"first_name": "Jane",
"last_name": "Smith",
"custom_fields": { "company": "NewCorp" },
"unsubscribed": false,
"audiences": [
{
"id": "aud_xxx",
"name": "Newsletter",
"subscriber": {
"id": "sub_xxx",
"subscribed": true,
"subscribed_at": "2026-02-10T10:00:00.000000+00:00",
"unsubscribed_at": null,
"created_at": "2026-02-10T10:00:00.000000+00:00",
"updated_at": "2026-02-10T10:00:00.000000+00:00"
}
}
],
"created_at": "2026-02-10T10:00:00.000000+00:00",
"updated_at": "2026-02-12T09:00:00.000000+00:00"
}