Boxes
The box concept is described here.
tip
Need some changes ? More endpoints ? Please open a github issue or contact us at love@misakey.com.
#
Create a boxA box should be created with a datatag and a data subject.
The data subject is supposed to be the email of the person concerned by the data. After being connected on Misakey using this email, data subjects can see boxes you have created and linked to their email. They have access to the box and its data.
info
Do not forget to save the id of the created box to later send data to it.
#
Request#
Authorizations- Organization
- User
Authorization
: a bearer access token for your organization. Example: Authorization: Bearer 2YotnFZFEjr1zCsicMWpAA
Path Parameters:
oid
(uuid string): your organization id.
JSON Body:
title
: (string) a free text that is meant to describe the box purpose for the end-usersowner_org_id
: (string) your organization iddatatag_id
: (string) the datatag iddatatag_subject
: (string) email of the person concerned by the datapublic_key
: (string, unpadded url-safe base64): the public key of the box. If it is forcom.misakey.aes-rsa-enc
algorithm, it must be prefixed withcom.misakey.aes-rsa-enc:
key_share
: (object) (optional) see the key share guide for more informationcrypto
: (object) (optional) data used for cryptographic side-effects of the creation of the box (creation of cryptogrpahic auto-invitations, of crypto provisions, etc ...)crypto.invitation_data
: (object) (optional) the auto-invitations to create together with this box. This is a mapping from public keys to invitation encrypted payload. See the auto invitation reference about how to create auto invitations.crypto.provisions
: (object) (optional) see the crypto provisions guide
tip
It is recommended to use key_share
to have a way to share the crypto materials to the data subject.
Note that the access mode of a box is limited by default. A state.access_mode
event must be created to switch it to public
, see the related event type documentation.
#
ResponseJSON Body:
The most important part is the id
field
which must be used to interact with the box.
#
Boxes search#
Count boxesIt is possible to count boxes with optional filtering using query parameters. This can be use to handle in amount pagination for listing.
Only boxes you have access to will be counted.
#
Request#
Authorizations- Organization
- User
Authorization
: a bearer access token for your organization. Example: Authorization: Bearer 2YotnFZFEjr1zCsicMWpAA
accesstoken
(opaque token) (ACR >= 2): mid claim as a member of the box.tokentype
(string): must be bearer.
X-CSRF-Token
: a token to prevent from CSRF attacks.
Query Parameters: To filter more precisely your request:
owner_org_id
: (optional) (string, uuid) the organization id which is owner of the box. Default: the organization id making the request.datatag_ids
: (optional) (comma-separated list of strings, uuid) ids of datatag you want to retrieve.""
for boxes with no datatag. Default: all. Example: datatag_ids=7523588e-9c3d-4c9d-83b7-d98663bf1215,d9c01c3e-955a-4e98-b9f7-2610cc857108,"".data_subject
: (optional) (string) the subject value (identifier value - email). Default: all.
#
ResponseCode:
Headers:
- X-Total-Count (integer): the total count of boxes considering filters.
#
List boxesIt is possible to retrieve a list of boxes with optional filtering using query parameters.
Only boxes you have access to will be returned.
#
Request#
Authorizations- Organization
- User
Authorization
: a bearer access token for your organization. Example: Authorization: Bearer 2YotnFZFEjr1zCsicMWpAA
accesstoken
(opaque token) (ACR >= 2): mid claim as a member of the box.tokentype
(string): must be bearer.
X-CSRF-Token
: a token to prevent from CSRF attacks.
Query Parameters: To filter more precisely your request:
owner_org_id
: (optional) (string, uuid) the organization id which is owner of the box. Default: the organization id making the request.datatag_ids
: (optional) (comma-separated list of strings, uuid) ids of datatag you want to retrieve.""
for boxes with no datatag. Default: all. Example: datatag_ids=7523588e-9c3d-4c9d-83b7-d98663bf1215,d9c01c3e-955a-4e98-b9f7-2610cc857108,"".data_subject
: (optional) (string) the subject value (identifier value - email). Default: all.- Pagination (more info). Default limit is 500.
#
ResponseReturn an empty array if no boxes have been found.
#
MessagesMessages are the entity bearing data inside a box (which acts as a messages chat).
#
Send data as a text message#
Request#
Authorizations- Organization
- User
Authorization
: a bearer access token for your organization. Example: Authorization: Bearer 2YotnFZFEjr1zCsicMWpAA
accesstoken
(opaque token) (ACR >= 2): mid claim as a member of the box.tokentype
(string): must be bearer.
X-CSRF-Token
: a token to prevent from CSRF attacks.
Path Parameters:
id
: (string, uuid) id of the box
JSON Body:
type
: (string) must bemsg.text
content
:encrypted
: (string, unpadded url-safe base64) the encrypted message. Recall that files are sent separately in another way, so the size of a text message event should stay rather small.
#
Responseid
: (string, uuid) unique id the of message eventtype
: (string):msg.text
box_id
: (string, uuid) id of the boxserver_event_created_at
: (date) server date creationsender
: (object) contains event sender informationcontent
: (object) the content of themsg.text
eventreferrer_id
: (string, nullable): will be null in this case
#
Send data as a message fileThe upload of an encrypted file triggers the creation of a msg.file
event on the box then returns it.
#
Request#
Authorizations- Organization
- User
Authorization
: a bearer access token for your organization. Example: Authorization: Bearer 2YotnFZFEjr1zCsicMWpAA
accesstoken
(opaque token) (ACR >= 2): mid claim as a member of the box.tokentype
(string): must be bearer.
X-CSRF-Token
: a token to prevent from CSRF attacks.
Path Parameters:
id
(uuid string): the box unique id the file is uploaded in.
#
Encryption mecanism for filesIncoming a description about how to consider encrypted_file & msg_encrypted_content...
Multipart Form Data Body:
encrypted_file
(binary): the file, encrypted.msg_encrypted_content
(string, unpadded url-safe base64): encrypted content that will be store in the createdmsg.file
event.
#
ResponseJSON Body:
id
: (string, uuid) unique id the of message eventtype
: (string): "msg.file"box_id
: (string, uuid) id of the boxserver_event_created_at
: (date) server date creationsender
: (object) contains event sender informationcontent
:encrypted
: (binary) the encrypted data containing information about how to decrypt the filepublic_key
: (string): the box public key should have been used to encrypt the dataencrypted_file_id
: (string, uuid) the generated unique id representing the file
referrer_id
: (string, nullable): will be null in this case
info
Note that the msg.file object does not contain the file content but only information about how to retrieve the file and how to decrypt it:
encrypted_file_id
should be used on Download a file route.encrypted
contains encrypted data itself containing information about how to decrypt the downloaded file. See here.
#
Notable Error Responses1 - The file is too big:
Code:
tip
If you need to upload file bigger than the current limit (126MB). Please contact us and we will certainly increase the limit or define a strategy together.
#
Count messages of a boxYou may want to count messages before listing them.
#
RequestQuery Parameters:
type
(string) (optional) (one of: msg.text, msg.file): if you want to filter only text or file messages. Return all messages if not set.
#
Authorizations- Organization
- User
Authorization
: a bearer access token for your organization. Example: Authorization: Bearer 2YotnFZFEjr1zCsicMWpAA
Path Parameters:
id
(uuid string): the box id.
#
ResponseCode:
Headers:
- X-Total-Count (integer): the total count of messages.
#
List messages of a boxThe messages are returned from the latest message sent to the box to the oldest one.
#
Authorizations- Organization
- User
Authorization
: a bearer access token for your organization. Example: Authorization: Bearer 2YotnFZFEjr1zCsicMWpAA
Path Parameters:
id
(uuid string): the box id.
Query Parameters:
types
(optional) (comma-separated list of string) (accepted values: msg.text, msg.file): if you want to filter for specific type of messages. Default: msg.text,msg.file.- Pagination (optional) (more info here). Default limit is 500.
#
ResponseReturn an array of messages. An empty array is returned when no messages can be found.
Note that the content
format may differ according to the type of message (see example below).
Code:
JSON Body:
info
Note that the msg.file object does not contain the file content but only information about how to retrieve the file and how to decrypt it:
encrypted_file_id
should be used on Download a file route.encrypted
contains encrypted data itself containing information about how to decrypt the downloaded file. See here.
#
Download an encrypted fileDownload an encrypted file as an octet-stream
.
#
Request#
Authorizations- Organization
- User
Authorization
: a bearer access token for your organization. Example: Authorization: Bearer 2YotnFZFEjr1zCsicMWpAA
accesstoken
(opaque token) (ACR >= 2): mid claim as a member of the box.tokentype
(string): must be bearer.
X-CSRF-Token
: a token to prevent from CSRF attacks.
Path Parameters:
id
(string, uuid): the encrypted file id contained in the content of themsg.file
event.
#
ResponseCode:
Headers:
Content-Type: application/octet-stream
: the response is an octet stream.
Octect Stream Body:
#
Delete a message from a boxA message (text or file) can be deleted by its author or by the box admin.
#
Request#
Authorizations- Organization
- User
Authorization
: a bearer access token for your organization. Example: Authorization: Bearer 2YotnFZFEjr1zCsicMWpAA
accesstoken
(opaque token) (ACR >= 2): mid claim as a member of the box.tokentype
(string): must be bearer.
X-CSRF-Token
: a token to prevent from CSRF attacks.
Path Parameters:
id
(string, uuid): the box id.
JSON Body:
type
: (string): should be msg.delete.referrer_id
: (string, uuid) the id of the message to delete.
#
ResponseJSON Body:
#
Box information#
Retrieve a box informationA box can be retrieved using your organization token.
#
Request#
Authorizations- Organization
- User
Authorization
: a bearer access token for your organization. Example: Authorization: Bearer 2YotnFZFEjr1zCsicMWpAA
Path Parameters:
oid
(uuid string): your organization id.id
(uuid string): the box id wished to be retrieved.
#
ResponseCode:
JSON Body:
#
Delete a boxOnly box admins are able to delete corresponding boxes.
A removed box sees its data completely removed from Misakey storage. This action is irreversible.
This action removes all data related to the box (events, files, key-shares...).
#
Request#
Authorizations- Organization
- User
Authorization
: a bearer access token for your organization. Example: Authorization: Bearer 2YotnFZFEjr1zCsicMWpAA
accesstoken
(opaque token) (ACR >= 2): mid claim as a member of the box.tokentype
(string): must be bearer.
X-CSRF-Token
: a token to prevent from CSRF attacks.
Path Parameters:
id
(string, uuid): the box id wished to be deleted.
JSON Body:
user_confirmation
(string) (one of: delete, supprimer): the input the end-identity has entered to confirm the deletion. The server will check if the value corresponds to some expected strings (cf one of).
#
ResponseCode: