API-of-Me
Search…
Items and Slots
This guide describes creating Items and Item Templates using the Meeco API.

Basic Terms

  • Name — A machine-readable non-empty string, for example phone_number or postal_address.
  • Label — A human-readable non-empty string, for example "Phone Number", or "Postal Address". Objects often have both a name and a label with a direct relationship between the two, as suggested by the example.
  • Slot — The smallest data entity in the vault. Each slot has a name, a label, and a value. Values can be strings, dates, or numbers, but also binaries like images or documents. Values are always encrypted. Read more
  • Item Template — A list of empty slots with a label and a name. Each Item is created by cloning such a template and filling in the slots. More detail about Item Templates in the Terminology section
  • Item — Contains one or more slots with filled in values. Read more about Items in the Terminology section

Browsing Item Templates

Items are created from templates, so we begin by listing all available Item templates:
1
curl --request GET 'https://sandbox.meeco.me/vault/item_templates' \
2
-H "Authorization: Bearer $VAULT_ACCESS_TOKEN" \
3
-H "Meeco-Subscription-Key: $API_SUBSCRIPTION_KEY"
Copied!
API docs
(Get API_SUBSCRIPTION_KEY by signing up for the API, then use the CLI tool to generate a User and access token.)
The response JSON object lists Templates under the item_templates key. Each Template object has a slot_ids list, which references Slots in the top-level slots list.
Here is a truncated sample response:
1
{
2
"item_templates": [
3
{
4
"id": "ccfaadf6-e040-433f-ad34-904e988a2187",
5
"name": "travel",
6
"description": null,
7
"ordinal": 10,
8
"visible": true,
9
"user_id": null,
10
"updated_at": "2020-01-02T20:32:49.991Z",
11
"template_type": "ItemTemplate",
12
"classification_node_ids": [],
13
"label": "Travel",
14
"background_color": null,
15
"image": "https://api-sandbox.meeco.me/images/7308dc39-d2b1-4039-9960-34f69dd06cd7",
16
"association_ids": [],
17
"associations_to_ids": [],
18
"slot_ids": [
19
"0cf77509-6eaf-49ff-a036-c3c7e2fee106",
20
"f1668277-0db5-4cff-9210-08a2f245c4aa",
21
"23eea243-1d09-4000-9215-7c1bc534c141",
22
"b57a5d9a-f124-4ddd-954f-18681b2360f1",
23
"929ea8b9-9815-4389-99a9-163f9e0c8b15"
24
]
25
},
26
...
27
],
28
"slots": [
29
{
30
"id": "f1668277-0db5-4cff-9210-08a2f245c4aa",
31
"name": "return_date",
32
"description": null,
33
"encrypted": false,
34
"ordinal": 2,
35
"visible": true,
36
"classification_node_ids": [],
37
"slotable_id": "ccfaadf6-e040-433f-ad34-904e988a2187",
38
"slotable_type": "ItemTemplate",
39
"required": false,
40
"updated_at": "2020-01-02T20:32:49.761Z",
41
"created_at": "2020-01-02T20:32:49.761Z",
42
"config": null,
43
"slot_type_name": "date",
44
"creator": "system",
45
"binary_ids": [],
46
"label": "Return date",
47
"image": null,
48
"encrypted_value": null
49
},
50
...
51
],
52
"shares": [],
53
"classification_nodes": [
54
...
55
],
56
"associations": [],
57
"associations_to": [],
58
"attachments": [],
59
"thumbnails": [],
60
"meta": {
61
"pages": null,
62
"total_count": null
63
}
64
}
Copied!
Here's a sample of Item Templates you might get:
  • passport_details
  • password
  • important_document
  • vehicle
  • travel
  • bank_item
  • membership_subscription
  • pet
  • device
  • important_document
  • custom
  • services

Finding a Specific Template

You can get a specific Template using its id (replace ITEM-TEMPLATE-ID):
1
curl --request GET 'https://sandbox.meeco.me/vault/item_templates/ITEM-TEMPLATE-ID' \
2
-H 'Authorization: Bearer $VAULT_ACCESS_TOKEN' \
3
-H 'Meeco-Subscription-Key: $API_SUBSCRIPTION_KEY'
Copied!
API docs
Or, to search Item Templates by matching label text (replace SEARCH_TEXT):
1
curl --request GET 'https://sandbox.meeco.me/vault/item_templates?like=SEARCH_TEXT' \
2
-H 'Authorization: Bearer $VAULT_ACCESS_TOKEN' \
3
-H 'Meeco-Subscription-Key: $API_SUBSCRIPTION_KEY'
Copied!
API docs

Creating an Item

The example below creates an Item from the vehicle Template.
Using the CLI, we can see that the vehicle Template has the following Slots:
  • model_make
  • licence_plate
  • vin
  • type
  • purchase_date
For now the new Item's Slots are left empty. A later section will cover encrypting data and adding it to a created Item.
To create an Item you must give the name of an existing Item Template, and a label:
1
curl --request POST 'https://sandbox.meeco.me/vault/items' \
2
-H 'Authorization: Bearer $VAULT_ACCESS_TOKEN' \
3
-H 'content-type: application/json' \
4
-H 'Meeco-Subscription-Key: $API_SUBSCRIPTION_KEY' \
5
--data \
6
'{
7
"template_name": "vehicle",
8
"item": {
9
"label": "My Car"
10
}
11
}'
Copied!
API docs
The API response is the newly created Item:
1
{
2
"item": {
3
"id": "e053853d-6a7e-476b-8e3b-d78b4e6d2802",
4
"name": "vehicle",
5
"label": "Vehicle",
6
"description": null,
7
"created_at": "2020-03-12T04:38:24.110Z",
8
"item_template_id": "61516c6f-81df-4c86-96df-8af915f0aec0",
9
"ordinal": 1,
10
"visible": true,
11
"updated_at": "2020-03-12T04:38:24.556Z",
12
"item_template_label": "Vehicle",
13
"shareable": false,
14
...
15
"association_ids": [],
16
"associations_to_ids": [],
17
"slot_ids": [
18
"f84d82be-7d82-4ccb-b7ae-e30be5b036c9",
19
"6e1e4ecc-0b8b-45c1-919f-01e69f05bbf8",
20
"f09975cc-ec8e-4744-b883-73c115d32434",
21
"32d1f51b-d26e-4c85-8589-133a4f8e4579",
22
"5addd943-948d-4f80-b1e8-771ff5fee2c1",
23
"1fdd1473-a178-43dc-8862-c1aa242cf861",
24
"e4d7f7ed-de2c-4819-9369-478f2357b6aa",
25
"4cd09df4-9b69-4579-9e76-9a6d7c314b02"
26
]
27
},
28
"classification_nodes": [],
29
"shares": [],
30
"connections": [],
31
"attachments": [],
32
"thumbnails": [],
33
"slots": [
34
{
35
"id": "f84d82be-7d82-4ccb-b7ae-e30be5b036c9",
36
"name": "image",
37
"description": null,
38
"encrypted": false,
39
"ordinal": 6,
40
"visible": true,
41
"classification_node_ids": [],
42
"slotable_id": "e053853d-6a7e-476b-8e3b-d78b4e6d2802",
43
"slotable_type": "Item",
44
"required": false,
45
"updated_at": "2020-03-12T04:38:24.531Z",
46
"created_at": "2020-03-12T04:38:24.531Z",
47
"config": null,
48
"slot_type_name": "image",
49
"creator": "system",
50
"binary_ids": [],
51
"label": "Image",
52
"image": null,
53
"encrypted_value": null
54
},
55
...
56
57
],
58
"associations": [],
59
"associations_to": []
60
}
Copied!
Notice that Slots are created according to the Item Template, but are left empty for now.
Items can also be classified, that is described in another page.

Item Names

An Item's name is auto-generated from its label. Names are all lower-case, have no non-alphanumeric characters, and have whitespace replaced with underscores. For example, label A strange &8Label would become a_strange_8label.
Any user specified names (for Slots and Items) are sanitized to this format.
Item names and labels do not have to be unique, unlike Item Template names.

Extra Slots

The Slots in the Item Template are present in every Item created from that Template, but Items can have additional Slots too. Any extra Slots described in slots_attributes are created for the new Item.
For example, if my_template had Slots foo and bar, and we create an Item with
1
{
2
"template_name": "my_template",
3
"item": {
4
"label": "A Test Item",
5
"slots_attributes": [
6
{
7
"label": "baz",
8
"slot_type_name": "key_value"
9
}
10
]
11
}
12
}
Copied!
Then the new Item will have Slots foo, bar and baz.
The next section has more information about creating Slots.

Creating a Custom Template

It is possible to create a Custom Template which we can use to create our own Items.
Only the label property is required, it will auto-generate a name (as described above). Since Item Templates are referenced by their name, the generated name must be unique. You can specify it separately if the label does not generate a unique name.
1
curl --request POST "https://sandbox.meeco.me/vault/item_templates" \
2
-H "Content-Type: application/json" \
3
-H "Meeco-Subscription-Key: $API_SUBSCRIPTION_KEY" \
4
-H "authorization: Bearer $VAULT_ACCESS_TOKEN" \
5
--data \
6
'{
7
"name": "example_custom_template",
8
"label": "Example Custom Template",
9
"description": "An example template",
10
"slots_attributes": [
11
{
12
"label": "An Example Slot",
13
"slot_type_name": "key_value"
14
}
15
]
16
}'
Copied!
The new Template will look like this:
1
{
2
"item_template": {
3
"id": "66c6b284-434e-4411-9435-7bd70a74c6d2",
4
"name": "example_custom_template",
5
"description": "An example template",
6
"ordinal": 0,
7
"visible": true,
8
"user_id": "68a2cdb3-4a9d-42ac-83e7-d7e4967143a0",
9
"updated_at": "2020-09-28T02:03:11.348Z",
10
"label": "Example Custom Template",
11
"slot_ids": [
12
"e019d2a6-36ed-4768-9aec-273879273d23"
13
],
14
"classification_node_ids": [],
15
"background_color": null,
16
"image": null
17
},
18
"slots": [
19
{
20
"id": "e019d2a6-36ed-4768-9aec-273879273d23",
21
"name": "an_example_slot",
22
"description": null,
23
"encrypted": false,
24
"ordinal": 0,
25
"visible": true,
26
"classification_node_ids": [],
27
"item_id": null,
28
"required": false,
29
"updated_at": "2020-09-28T02:03:11.424Z",
30
"created_at": "2020-09-28T02:03:11.376Z",
31
"config": null,
32
"slot_type_name": "key_value",
33
"creator": null,
34
"label": "An Example Slot",
35
"image": null,
36
"attachment_id": null,
37
"own": false,
38
"share_id": null,
39
"original_id": null,
40
"owner_id": null,
41
"encrypted_value": null,
42
"encrypted_value_verification_key": null,
43
"value_verification_hash": null
44
}
45
],
46
"classification_nodes": [],
47
"attachments": [],
48
"thumbnails": []
49
}
Copied!
Then, you can create an item from your new template:
1
curl --request POST "https://sandbox.meeco.me/vault/items" \
2
-H "content-type: application/json" \
3
-H "Authorization: Bearer $VAULT_ACCESS_TOKEN" \
4
-H "Meeco-Subscription-Key: $API_SUBSCRIPTION_KEY" \
5
--data \
6
'{
7
"item": {
8
"label": "An example item with custom template",
9
"slots_attributes": []
10
},
11
"template_name": "example_custom_template"
12
}'
Copied!
The created item comes back looking like the following, with a custom slot that was part of the template creation call.
1
{
2
"item": {
3
"id": "98db3af3-c430-45ce-a5eb-cce89b19f736",
4
"name": "an_example_item_with_custom_template",
5
"label": "An example item with custom template",
6
"description": "An example template",
7
"created_at": "2020-09-28T02:12:56.194Z",
8
"item_template_id": "66c6b284-434e-4411-9435-7bd70a74c6d2",
9
"ordinal": 1,
10
"visible": true,
11
"updated_at": "2020-09-28T02:12:56.271Z",
12
"item_template_label": "Example Custom Template",
13
"item_image": null,
14
"item_image_background_colour": null,
15
"slot_image": null,
16
"slot_image_background_colour": null,
17
"category_image": null,
18
"category_image_background_colour": null,
19
"category_label": null,
20
"original_id": null,
21
"owner_id": "68a2cdb3-4a9d-42ac-83e7-d7e4967143a0",
22
"share_id": null,
23
"image": null,
24
"image_background_colour": null,
25
"me": false,
26
"background_color": null,
27
"classification_node_ids": [],
28
"association_ids": [],
29
"associations_to_ids": [],
30
"slot_ids": [
31
"445ee1d0-0100-458d-9f7a-4698b6aaf1f0"
32
],
33
"own": true
34
},
35
"associations": [],
36
"associations_to": [],
37
"classification_nodes": [],
38
"slots": [
39
{
40
"id": "445ee1d0-0100-458d-9f7a-4698b6aaf1f0",
41
"name": "an_example_slot",
42
"description": null,
43
"encrypted": false,
44
"ordinal": 0,
45
"visible": true,
46
"classification_node_ids": [],
47
"item_id": "98db3af3-c430-45ce-a5eb-cce89b19f736",
48
"required": false,
49
"updated_at": "2020-09-28T02:12:56.247Z",
50
"created_at": "2020-09-28T02:12:56.247Z",
51
"config": null,
52
"slot_type_name": "key_value",
53
"creator": "user",
54
"label": "An Example Slot",
55
"image": null,
56
"attachment_id": null,
57
"own": true,
58
"share_id": null,
59
"original_id": null,
60
"owner_id": "68a2cdb3-4a9d-42ac-83e7-d7e4967143a0",
61
"encrypted_value": null,
62
"encrypted_value_verification_key": null,
63
"value_verification_hash": null
64
}
65
],
66
"attachments": [],
67
"thumbnails": []
68
}
Copied!
Notice that the Item's description property inherits the description of the Item Template.
There are a few limitations on the use of Item Templates:
  • There currently isn't a way to share custom templates with other users.
  • Templates cannot be changed or deleted

Slots

Slots represent a key-value pair, where the value is always encrypted. The Meeco Vault will check and reject any encrypted_value data that doesn't match the cryppo serialization format.
Slots are always owned by an Item (or an Item Template, but these Slots are never read), and news Slots are created for each new Item.
Their most important properties are:
Property
Description
name
Machine-readable string
label
Display name
description
Longer name
encrypted_value
Output of Cryppo encryption
slot_type_name
string
The slot_type_name property must be one of
  • key_value
  • bool
  • classification_node
  • color
  • date
  • datetime
  • image
  • note_text
  • select
  • attachment
  • url
  • phone_number
  • select_multiple
  • email
  • password
As the Vault cannot inspect the data, it is just a suggestion to the user. Type key_value is the default.
Slots are created either by cloning an Item Template, or via the slots_attributes property when creating an Item. Since they are keyed by name, either label or name must be non-empty on creation.
Slots are updated by calling PUT /vault/items with the new data in slots_attributes:
1
curl --request PUT "https://sandbox.meeco.me/vault/items/bef961af-aa1f-4f1c-ac95-cdb41b3682db" \
2
-H "content-type: application/json" \
3
-H "Authorization: Bearer $VAULT_ACCESS_TOKEN" \
4
-H "Meeco-Subscription-Key: $API_SUBSCRIPTION_KEY" \
5
--data \
6
'{
7
"item": {
8
"slots_attributes": [
9
{
10
"name": "bar",
11
"label": "A new label"
12
}
13
]
14
}
15
}'
Copied!
As Slots are keyed by their names, names should be unique per Item.
Slots can also be deleted by calling DELETE /slot/id. This deletes the Slot (and it's data) from the parent Item.
Slots in Item Templates cannot be deleted.

Encryption of User Data

One of the core features of the Meeco platform is data encryption. User data stored in the Meeco Vault is encrypted in such a way that no one - including Meeco - can decrypt and read it other than the user.
If we want to store data in an Item we must encrypt it, otherwise the Vault will return an error.
To get familiar with the kinds of cryptographic key the Meeco platform uses please follow either the Quickstart guide, or "Setting Up Access to the Vault and Keystore". That will introduce you to the Cryppo library that we use to make encryption, decryption and serialization simpler in the context of the Meeco Service.
In the following example, we will use the Data Encryption Key (DEK) that the CLI generated for us from the Quickstart guide (and saved into the `.user.yaml` file) to encrypt a Slot value.
In the real world this process would involve a few more steps:
  • Reading the encrypted Key Encryption Key (KEK) from the Key Store
  • Decrypting it with the Password Derived Key (PDK)
  • Reading a DEK from the Key Store
  • Decrypting it with the KEK
If you do not have a DEK already, you can also generate one using the `cryppo-cli` and the following command:
1
cryppo genkey
Copied!
Result:
1
URL-Safe Base64 encoded key:
2
3YazDa71zVVCzh_6JRd_M-J5bOKUS5HtFGLNR45prPg=
Copied!
To encrypt slot value `BMW` run the following command:
1
cryppo encrypt -v BMW -k 3YazDa71zVVCzh_6JRd_M-J5bOKUS5HtFGLNR45prPg=
Copied!
Result:
1
Aes256Gcm.MtK4.LS0tCml2OiAhYmluYXJ5IHwtCiAgdXN4NnozRnRUc2FldlBmdgphdDogIWJpbmFyeSB8LQogIHc2YmRTM252Z2o4TTZYSE9FUnhHd1E9PQphZDogbm9uZQo=
Copied!
The output above is the encrypted slot value ready to be stored in the Vault.
We can decrypt by running the following command:
1
cryppo decrypt -s Aes256Gcm.MtK4.LS0tCml2OiAhYmluYXJ5IHwtCiAgdXN4NnozRnRUc2FldlBmdgphdDogIWJpbmFyeSB8LQogIHc2YmRTM252Z2o4TTZYSE9FUnhHd1E9PQphZDogbm9uZQo= -k 3YazDa71zVVCzh_6JRd_M-J5bOKUS5HtFGLNR45prPg=
2
BMW
Copied!
The Meeco platform uses the serialization format of Cryppo. If no derived key is used, each such string contains three parts concatenated with a dot:
  • Encryption strategy name
  • Encoded encrypted data encoded with Base64
  • Encoded encryption artefacts serialized into a hash converted to YAML, then encoded with Base64
If you are feeling adventurous you are welcome to dig into the Cryppo-CLI
The example below creates an Item config file. We need to provide a template name to create an item config file.
1
meeco items:create-config TEMPLATENAME > .item_config.yaml
Copied!
This command will create the config file for the item to be created in the next step. The TEMPLATENAME can be any template from the list above.
The Meeco CLI can then create the item by the following command:
1
meeco items:create .item_config.yaml
Copied!
will create the Item encrypting the Slots described in .item_config.yaml using the current user's keys.
You can also integrate this flow into your app using the Meeco SDK's UserService.

Filling Slot Values

Thanks to the Item Template our new Item already has a list of empty Slots, and a list of classification tags. Let's fill in a value of the `encryptedvalue` slot using the encrypted value from the previous step:
1
curl --request PUT \
2
'https://sandbox.meeco.me/vault/items/049740cb-ad1f-43d9-9254-ae25eba30f47' \
3
-H 'Authorization: $VAULT_ACCESS_TOKEN' \
4
-H 'content-type: application/json' \
5
-H 'Meeco-Subscription-Key: $API_SUBSCRIPTION_KEY' \
6
-d '
7
{
8
"item": {
9
"label": "vehicle",
10
"slots_attributes": [
11
{
12
"label": "Make or model",
13
"encrypted_value": "Aes256Gcm.MtK4.LS0tCml2OiAhYmluYXJ5IHwtCiAgdXN4NnozRnRUc2FldlBmdgphdDogIWJpbmFyeSB8LQogIHc2YmRTM252Z2o4TTZYSE9FUnhHd1E9PQphZDogbm9uZQo=",
14
"slot_type_name": "key_value",
15
"name": "model_make"
16
}
17
]
18
}
19
}
20
'
Copied!
Response:
1
{
2
"item": {
3
...
4
},
5
...
6
"slots" [
7
...
8
{
9
"id": "ce9d89f8-a50a-486a-b007-d1cb006ee157",
10
"name": "model_make",
11
"description": null,
12
"encrypted": true,
13
"ordinal": 1,
14
"visible": true,
15
"classification_node_ids": [],
16
"slotable_id": "049740cb-ad1f-43d9-9254-ae25eba30f47",
17
"slotable_type": "Item",
18
"required": false,
19
"updated_at": "2020-03-18T06:49:31.160Z",
20
"created_at": "2020-03-18T06:49:17.549Z",
21
"config": null,
22
"slot_type_name": "key_value",
23
"creator": "system",
24
"binary_ids": [],
25
"label": "Make or model",
26
"image": null,
27
"encrypted_value": "Aes256Gcm.MtK4.LS0tCml2OiAhYmluYXJ5IHwtCiAgdXN4NnozRnRUc2FldlBmdgphdDogIWJpbmFyeSB8LQogIHc2YmRTM252Z2o4TTZYSE9FUnhHd1E9PQphZDogbm9uZQo="
28
},
29
],
30
}
Copied!

Shared Items

The page on Connections and Sharing covers sharing Items. This section will just describe some properties of shared Items.

Receiving A Share

You receive a shared item by calling PUT https://sandbox.meeco.me/vault/incoming_shares/{share_id}/accept. (This indicates you accept the share terms, if any). Next call GET https://sandbox.meeco.me/vault/incoming_shares/{share_id}/item and view the Item that has been created in your Vault. Note that share.item_id is the original Item's id, not the one in your Vault!

Owners

An Item's owner is its original creator. The following table summarizes the how properties of an Item change when you are the owner, vs the receiver of a shared copy.
Property
Owner Vaule
Receiver Value
own
true
false
original_id
null
share.item_id
share_id
null
share.id
As a result, if item.share_id is non-null, then it is a share you received, and you can view the share via GET https://sandbox.meeco.me/vault/incoming_shares/{item.share_id}.
Owners have the ability to push updates of shared data, and can share the Item with anyone. Receivers of a shared Item can only share that Item if item.sharing_mode is anyone.
Last modified 13d ago