Monica
Log in
API v1
v1
View as Markdown

Get a contact as a vCard

GET QUERY /api/v1/vaults/{vault}/contacts/{contact}/vcard

Retrieve one contact as a vCard file, the same card a device synchronising over CardDAV is given.

This is the one endpoint here that does not answer in JSON. The body is the card itself, vCard 4.0, with a file name attached, so what you receive can be written straight to disk or handed to an address book application.

The card carries the structured name, the nickname, the photo and the values the contact holds, each labelled as the structure labels it. Properties the product has no field for, because a device wrote them, are carried through untouched.

Values of fields marked sensitive are left out unless the token presented carries the sensitive fields scope. A token minted for everything does not reach them: that scope has to be asked for by name.

Life events, relationships, reminders, notes and files attached to the contact are not in the card. vCard has nowhere to put them.

This endpoint answers GET and QUERY alike, and both return the same answer. GET sends the parameters in the address, QUERY in the request body. How QUERY works.

Path parameters

Path parameters go in the address. GET sends the others in the address too, QUERY sends them as JSON in the request body. Anything not listed here is ignored.

vault string Required

The vault the contact lives in, named either by the readable name it reports as slug or by its id. Both answer.

contact string Required

The contact, named either by the readable name it reports as slug or by its id. Both answer. A readable name is rebuilt whenever the record is renamed, and the previous one stops answering, so a client that stores a reference stores the id. A name a record has released is never given to another. The contact has to be in the vault the path names: a contact of yours addressed through the wrong vault answers 404, the same as one that never existed. A contact absorbed by a merge answers 404 here, and the merge endpoints say what became of them.

Returns

The card, as text. A contact belonging to somebody else answers 404, and so does one of your own addressed through the wrong vault.

Rate limit

Sixty requests per minute, per user, shared by every key and device. Every answer carries the budget left in X-RateLimit-Remaining.

GET
curl https://people.hansyeoh.com/api/v1/vaults/9d4f1c2e-7b3a-4f88-9a2d-6c1e5b0f7a31/contacts/c4a1f7b2-8e36-4d59-b0a7-2f5c9d81e364/vcard \
-H "Authorization: Bearer $MONICA_TOKEN"
const response = await fetch('https://people.hansyeoh.com/api/v1/vaults/9d4f1c2e-7b3a-4f88-9a2d-6c1e5b0f7a31/contacts/c4a1f7b2-8e36-4d59-b0a7-2f5c9d81e364/vcard', {
headers: { Authorization: `Bearer ${token}` },
})
const data = await response.json()
$response = Http::withToken($token)->get('https://people.hansyeoh.com/api/v1/vaults/9d4f1c2e-7b3a-4f88-9a2d-6c1e5b0f7a31/contacts/c4a1f7b2-8e36-4d59-b0a7-2f5c9d81e364/vcard');
QUERY
curl https://people.hansyeoh.com/api/v1/vaults/9d4f1c2e-7b3a-4f88-9a2d-6c1e5b0f7a31/contacts/c4a1f7b2-8e36-4d59-b0a7-2f5c9d81e364/vcard \
-X QUERY \
-H "Authorization: Bearer $MONICA_TOKEN"
const response = await fetch('https://people.hansyeoh.com/api/v1/vaults/9d4f1c2e-7b3a-4f88-9a2d-6c1e5b0f7a31/contacts/c4a1f7b2-8e36-4d59-b0a7-2f5c9d81e364/vcard', {
method: 'QUERY',
headers: { Authorization: `Bearer ${token}` },
})
const data = await response.json()
$response = Http::withToken($token)->query('https://people.hansyeoh.com/api/v1/vaults/9d4f1c2e-7b3a-4f88-9a2d-6c1e5b0f7a31/contacts/c4a1f7b2-8e36-4d59-b0a7-2f5c9d81e364/vcard');
Response 200

No content.

Keys act as you, with exactly the access you have. Make one per integration so you can revoke it alone.