Update a contact
PUT
/api/v1/mailbox/address-book/contacts/{card_id}Replaces the contact. Send the etag you read as a query parameter so a change made elsewhere is not lost.
Errors
| Status | When |
|---|---|
401 |
No token, or the session expired or was signed out. Sign in again with POST /mailbox-auth/login. |
403 |
The account has a temporary password: until POST /security/password succeeds, every other call answers this with error_code: password_change_required. |
400 |
No name, address or number. |
412 |
This contact changed elsewhere. Reopen it and try again. |
Parameters
| Name | In | Type | Description |
|---|---|---|---|
card_idrequired | path | string | |
etag | query | string | |
book | query | string |
Request body
full_namestring or nullThe name to show.
first_namestring or nullGiven name.
last_namestring or nullFamily name.
emailsarray<object>Addresses: each an
addressand optionaltype(work, home).addressstringrequiredtypestring or null
phonesarray<object>Numbers: each a
numberand optionaltype.numberstringrequiredtypestring or null
organizationstring or nullCompany.
titlestring or nullJob title.
addressstring or nullPostal address.
notestring or nullNotes.
birthdaystring or nullYYYY-MM-DD.
Request
PUT
/api/v1/mailbox/address-book/contacts/{card_id}curl -X PUT 'https://courier.mailyte.com/api/v1/mailbox/address-book/contacts/01JBT8XQ2M9WYC3K4F6R7S8T9V' \
-H 'Authorization: Bearer MAILBOX_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"full_name": "Tunde Bello",
"emails": [
{
"address": "tunde@example.com",
"type": "work"
}
],
"phones": [
{
"number": "+234 803 000 0000",
"type": "mobile"
}
],
"organization": "Example Ltd"
}'const response = await fetch('https://courier.mailyte.com/api/v1/mailbox/address-book/contacts/01JBT8XQ2M9WYC3K4F6R7S8T9V', {
method: 'PUT',
headers: {
Authorization: 'Bearer MAILBOX_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"full_name": "Tunde Bello",
"emails": [
{
"address": "tunde@example.com",
"type": "work"
}
],
"phones": [
{
"number": "+234 803 000 0000",
"type": "mobile"
}
],
"organization": "Example Ltd"
}),
});
const { data } = await response.json();import requests
response = requests.put(
"https://courier.mailyte.com/api/v1/mailbox/address-book/contacts/01JBT8XQ2M9WYC3K4F6R7S8T9V",
headers={"Authorization": "Bearer MAILBOX_TOKEN"},
json={
"full_name": "Tunde Bello",
"emails": [
{
"address": "tunde@example.com",
"type": "work"
}
],
"phones": [
{
"number": "+234 803 000 0000",
"type": "mobile"
}
],
"organization": "Example Ltd"
},
)
data = response.json()["data"]<?php
$response = Http::withToken('MAILBOX_TOKEN')
->put('https://courier.mailyte.com/api/v1/mailbox/address-book/contacts/01JBT8XQ2M9WYC3K4F6R7S8T9V', [
'full_name' => 'Tunde Bello',
'emails' => [
[
'address' => 'tunde@example.com',
'type' => 'work',
],
],
'phones' => [
[
'number' => '+234 803 000 0000',
'type' => 'mobile',
],
],
'organization' => 'Example Ltd',
]);
$data = $response->json('data');require "net/http"
require "json"
uri = URI("https://courier.mailyte.com/api/v1/mailbox/address-book/contacts/01JBT8XQ2M9WYC3K4F6R7S8T9V")
request = Net::HTTP::Put.new(uri)
request["Authorization"] = "Bearer MAILBOX_TOKEN"
request["Content-Type"] = "application/json"
request.body = {
"full_name": "Tunde Bello",
"emails": [
{
"address": "tunde@example.com",
"type": "work"
}
],
"phones": [
{
"number": "+234 803 000 0000",
"type": "mobile"
}
],
"organization": "Example Ltd"
}.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(request) }Response
Successful Response
dataobjectidstringetagstringThe new etag.
200
application/json{
"type": "success",
"msg": "Contact saved successfully",
"data": {
"id": "5d41402a.vcf",
"etag": "\"beef01\""
}
}Returned inside the standard envelope.
Errors
| Status | When |
|---|---|
400 | No name, address or number. |
401 | No token, or the session expired or was signed out. Sign in again with `POST /mailbox-auth/login`. |
403 | The account has a temporary password: until `POST /security/password` succeeds, every other call answers this with `error_code: password_change_required`. |
412 | `This contact changed elsewhere. Reopen it and try again.` |
422 | Validation Error |
Every status, with what causes it and what to do, is on the error reference.