Monica
Log in
API v1
v1
View as Markdown

Get the pages of a contact

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

Retrieve what is written on a contact, organised as their page shows it: every page of their template, its sections, and each field with its value.

Each field gives its value twice. value is the wording the contact page shows. input is the same value in the shape Save a section of a contact takes, so what you read can be changed and sent back: input.value goes in fields, input.label_id in labels, input.label_wording in label_wordings, and input.year_is_unknown and input.month_is_unknown under the same keys, each keyed by the id of the field. A field left empty is listed with all three null, so you know it can be filled.

What input.value holds depends on the type of the field. A text, a long text, an url, an email and a phone give a string. A number gives a number, and a duration a number of minutes. A yes or no gives true or false. A date gives YYYY-MM-DD: when year_is_unknown is true, the year is a placeholder and only the day and the month are known. A single choice gives the id of the item picked, and a multiple choice an array of ids. An address gives an object of po_box, extended, street, city, region, postal_code and country, where country is the two letter code, or an empty country and a country_name for a place that is not on the list. A relation gives the id of the contact or the entity it names.

A repeating field, such as phone numbers, gives its rows in the order they are stored, each with its id and the fields of the row shaped like any other field. Send them back in the same order, each with its id, to keep them as they are. A file, an image or an avatar gives the file it holds in file, and no input, since a file cannot be sent through the API.

To draw a field without reading its wording, a field also gives what its type needs: choices for a multiple choice, address_lines for an address, reminder for a date a reminder follows, record for a relation, and for a file its mime_type, size and content, the address Read the content of a contact's file answers at. A divider, a heading and a help text are listed in their place with stores_value set to false: they hold no value, and a client that only shows values can skip them.

Values of fields marked sensitive are withheld unless the token presented carries the sensitive fields scope: the field is listed with is_hidden set to true, and value, input, choices, address_lines, reminder, record, file and rows set to null.

Reading the pages is not written to your account log, and it does not count as somebody having consulted the record.

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 pages of the contact. A contact belonging to somebody else answers 404, and so does one of your own addressed through the wrong vault.

data object

The pages of the contact.

data.type string

Always contact_pages. It names the kind of record, so a caller holding several kinds can tell them apart without looking at where they came from.

data.id string

The id of this record, as a string even when it reads as a number. It is what every endpoint naming this record takes.

data.attributes object

Everything the record holds.

data.attributes.structure_version_id integer

The template version the pages come from, the one the contact renders from.

data.attributes.pages array

The pages of the template, in the order the contact page shows them as tabs. The Overview and Relationships tabs are not pages of a template and are not here.

data.attributes.pages[] object

One page.

data.attributes.pages[].id uuid

The id of the page in the template version.

data.attributes.pages[].key string

The key of the page, which the address of its tab carries.

data.attributes.pages[].label string

What the tab is called.

data.attributes.pages[].position integer

Where the page sits, counting from 1.

data.attributes.pages[].sections array

Its sections, in the order the page shows them. Empty when the page holds none.

data.attributes.pages[].sections[] object

One section.

data.attributes.pages[].sections[].id string

The id of the section, the one Save a section of a contact takes.

data.attributes.pages[].sections[].title string

What the section is called on this template, which may be a name given to it for this template only.

data.attributes.pages[].sections[].position integer

Where the section sits on its page.

data.attributes.pages[].sections[].fields array

Its fields, in order. A divider, a heading and a help text are listed in their place too: they hold no value, and stores_value says so.

data.attributes.pages[].sections[].fields[] object

One field.

data.attributes.pages[].sections[].fields[].id string

The id of the field, the key a value is sent under when the section is saved.

data.attributes.pages[].sections[].fields[].key string

The key of the field inside its section.

data.attributes.pages[].sections[].fields[].label string

What the field is called.

data.attributes.pages[].sections[].fields[].type string

The kind of field: text, textarea, number, boolean, url, email, phone, select, multiselect, radio, date, recurring_date, duration, relation, file, image, avatar, address, repeater, divider, heading or help.

data.attributes.pages[].sections[].fields[].is_required boolean

Whether the field has to hold a value.

data.attributes.pages[].sections[].fields[].is_sensitive boolean

Whether the field is marked sensitive.

data.attributes.pages[].sections[].fields[].is_hidden boolean

True when the field is sensitive and the token presented does not carry the sensitive fields scope. Its value, value_label, unlabelled_value, input, choices, address_lines, reminder, record, file and rows are then null.

data.attributes.pages[].sections[].fields[].stores_value boolean

False for a divider, a heading and a help text, which only shape the page: their value, value_label, unlabelled_value, input, choices, address_lines, reminder, record, file and rows are null, and Save a section of a contact ignores them.

data.attributes.pages[].sections[].fields[].help_text string

The help written for the field on the template, or null. For a help text, the words it shows.

data.attributes.pages[].sections[].fields[].value string

The value as the contact page shows it, in the formats of the person asking, or null when the field holds nothing.

data.attributes.pages[].sections[].fields[].value_label string

For an email, a phone or an address, its label: the wording typed, else the item picked in its list. It is the text value shows in brackets. Null for any other field, and when the value has no label.

data.attributes.pages[].sections[].fields[].unlabelled_value string

For an email, a phone or an address, the value as the contact page shows it without its label: the address on one line, a phone grouped. Null for any other field, and when the field holds nothing.

data.attributes.pages[].sections[].fields[].input object

The value as Save a section of a contact takes it back, or null when the field holds nothing, holds a file or is a repeating field. It holds value (sent in fields), label_id and label_wording (sent in labels and label_wordings, set for an email, a phone or an address only), and year_is_unknown and month_is_unknown (sent under the same keys). What value holds depends on the type of the field, as described above.

data.attributes.pages[].sections[].fields[].choices array

For a multiple choice, the labels of the items picked, in the order of their list. Null for any other field, and when nothing is picked.

data.attributes.pages[].sections[].fields[].address_lines array

For an address, its lines in the layout of its country, as the contact page draws them. Null for any other field, and when the address is empty.

data.attributes.pages[].sections[].fields[].reminder string

For a date or a yearly date at the top of a section, what the active reminder that follows it does, in the words the contact page shows. Null when no active reminder follows it, and for any other field.

data.attributes.pages[].sections[].fields[].record object

For a relation, who or what it points to: type (contact or entity), id, name, and for a contact its initials, avatar_colour and is_partial, for an entity the name of its entity_type. The keys that do not apply are null. Null for any other field, and when the relation points to nothing.

data.attributes.pages[].sections[].fields[].file object

For a file, an image or an avatar, the file it holds: its id, its name, the url the application shows it at, its mime_type, its size in bytes, and content, the address Read the content of a contact's file answers at with a key. Null otherwise.

data.attributes.pages[].sections[].fields[].rows array

For a repeating field, its rows in the order they are stored, each with its id, its position and fields, the fields of the row shaped like this one. Null for any other field.

data.links object

Where to find this record.

data.links.self string

The absolute address this record is read from.

data.links.web string

The page of the contact in the application, which opens for somebody signed in rather than for a key. It is the link to give a person.

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://monica-789392842564.asia-southeast1.run.app/api/v1/vaults/9d4f1c2e-7b3a-4f88-9a2d-6c1e5b0f7a31/contacts/c4a1f7b2-8e36-4d59-b0a7-2f5c9d81e364/pages \
-H "Authorization: Bearer $MONICA_TOKEN"
const response = await fetch('https://monica-789392842564.asia-southeast1.run.app/api/v1/vaults/9d4f1c2e-7b3a-4f88-9a2d-6c1e5b0f7a31/contacts/c4a1f7b2-8e36-4d59-b0a7-2f5c9d81e364/pages', {
headers: { Authorization: `Bearer ${token}` },
})
const data = await response.json()
$response = Http::withToken($token)->get('https://monica-789392842564.asia-southeast1.run.app/api/v1/vaults/9d4f1c2e-7b3a-4f88-9a2d-6c1e5b0f7a31/contacts/c4a1f7b2-8e36-4d59-b0a7-2f5c9d81e364/pages');
QUERY
curl https://monica-789392842564.asia-southeast1.run.app/api/v1/vaults/9d4f1c2e-7b3a-4f88-9a2d-6c1e5b0f7a31/contacts/c4a1f7b2-8e36-4d59-b0a7-2f5c9d81e364/pages \
-X QUERY \
-H "Authorization: Bearer $MONICA_TOKEN"
const response = await fetch('https://monica-789392842564.asia-southeast1.run.app/api/v1/vaults/9d4f1c2e-7b3a-4f88-9a2d-6c1e5b0f7a31/contacts/c4a1f7b2-8e36-4d59-b0a7-2f5c9d81e364/pages', {
method: 'QUERY',
headers: { Authorization: `Bearer ${token}` },
})
const data = await response.json()
$response = Http::withToken($token)->query('https://monica-789392842564.asia-southeast1.run.app/api/v1/vaults/9d4f1c2e-7b3a-4f88-9a2d-6c1e5b0f7a31/contacts/c4a1f7b2-8e36-4d59-b0a7-2f5c9d81e364/pages');
Response 200
{
"data": {
"type": "contact_pages",
"id": "c4a1f7b2-8e36-4d59-b0a7-2f5c9d81e364",
"attributes": {
"structure_version_id": 41,
"pages": [
{
"id": "f2b8d6a4-1c3e-4a59-9b07-5e8d2c4a6f13",
"key": "contact",
"label": "Contact",
"position": 1,
"sections": [
{
"id": "31",
"title": "Ways to reach",
"position": 1,
"fields": [
{
"id": "118",
"key": "nickname",
"label": "Nickname",
"type": "text",
"is_required": false,
"is_sensitive": false,
"is_hidden": false,
"stores_value": true,
"help_text": null,
"value": "Pammy",
"value_label": null,
"unlabelled_value": null,
"input": {
"value": "Pammy",
"label_id": null,
"label_wording": null,
"year_is_unknown": false,
"month_is_unknown": false
},
"choices": null,
"address_lines": null,
"reminder": null,
"record": null,
"file": null,
"rows": null
},
{
"id": "121",
"key": "partner",
"label": "Partner",
"type": "relation",
"is_required": false,
"is_sensitive": false,
"is_hidden": false,
"stores_value": true,
"help_text": null,
"value": "Jim Halpert",
"value_label": null,
"unlabelled_value": null,
"input": {
"value": "b7d2e9c4-3f18-4a6b-9e05-1c8a7f4d2b36",
"label_id": null,
"label_wording": null,
"year_is_unknown": false,
"month_is_unknown": false
},
"choices": null,
"address_lines": null,
"reminder": null,
"record": {
"type": "contact",
"id": "b7d2e9c4-3f18-4a6b-9e05-1c8a7f4d2b36",
"name": "Jim Halpert",
"initials": "JH",
"avatar_colour": "#3f5fd0",
"is_partial": false,
"entity_type": null
},
"file": null,
"rows": null
},
{
"id": "122",
"key": "portfolio",
"label": "Portfolio",
"type": "file",
"is_required": false,
"is_sensitive": false,
"is_hidden": false,
"stores_value": true,
"help_text": null,
"value": null,
"value_label": null,
"unlabelled_value": null,
"input": null,
"choices": null,
"address_lines": null,
"reminder": null,
"record": null,
"file": {
"id": "e1c5a8f2-7d49-4b03-a6e8-5f2b9c1d7a40",
"name": "portfolio.pdf",
"url": "https://monica-789392842564.asia-southeast1.run.app/vaults/dunder-mifflin/files/e1c5a8f2-7d49-4b03-a6e8-5f2b9c1d7a40",
"mime_type": "application/pdf",
"size": 245760,
"content": "https://monica-789392842564.asia-southeast1.run.app/api/v1/vaults/9d4f1c2e-7b3a-4f88-9a2d-6c1e5b0f7a31/contacts/c4a1f7b2-8e36-4d59-b0a7-2f5c9d81e364/files/e1c5a8f2-7d49-4b03-a6e8-5f2b9c1d7a40/content"
},
"rows": null
},
{
"id": "123",
"key": "reach-help",
"label": "Help",
"type": "help",
"is_required": false,
"is_sensitive": false,
"is_hidden": false,
"stores_value": false,
"help_text": "The desk phone rings at reception first.",
"value": null,
"value_label": null,
"unlabelled_value": null,
"input": null,
"choices": null,
"address_lines": null,
"reminder": null,
"record": null,
"file": null,
"rows": null
},
{
"id": "119",
"key": "phone_numbers",
"label": "Phone numbers",
"type": "repeater",
"is_required": false,
"is_sensitive": false,
"is_hidden": false,
"stores_value": true,
"help_text": null,
"value": null,
"value_label": null,
"unlabelled_value": null,
"input": null,
"choices": null,
"address_lines": null,
"reminder": null,
"record": null,
"file": null,
"rows": [
{
"id": 77,
"position": 1,
"fields": [
{
"id": "120",
"key": "number",
"label": "Number",
"type": "phone",
"is_required": false,
"is_sensitive": false,
"is_hidden": false,
"stores_value": true,
"help_text": null,
"value": "+1 570 555 0100 (Mobile)",
"value_label": "Mobile",
"unlabelled_value": "+1 570 555 0100",
"input": {
"value": "+1 570 555 0100",
"label_id": 4,
"label_wording": null,
"year_is_unknown": false,
"month_is_unknown": false
},
"choices": null,
"address_lines": null,
"reminder": null,
"record": null,
"file": null,
"rows": null
}
]
}
]
}
]
}
]
}
]
},
"links": {
"self": "https://monica-789392842564.asia-southeast1.run.app/api/v1/vaults/9d4f1c2e-7b3a-4f88-9a2d-6c1e5b0f7a31/contacts/c4a1f7b2-8e36-4d59-b0a7-2f5c9d81e364/pages",
"web": "https://monica-789392842564.asia-southeast1.run.app/vaults/dunder-mifflin/contacts/pam-beesly"
}
}
}

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