Create Share
Create a share record for data exchange between qid accounts
POST /di/share
Body
| Property | Type | Required | Description |
|---|---|---|---|
templateId | string | Yes | Template ID for the share. Must be a valid ObjectId. |
otherFields | Fields[] | No | Additional form fields. Stored exactly as sent. |
participants | Participant[] | Yes | Accounts involved in the share. At least one participant must have the organiser role. |
status | string | Yes | Initial share status: open or completed. closed is not accepted on create (the API returns 500). |
Example request
curl --request POST 'https://api.qidpro.xyz/di/share' \
--header 'Authorization: Bearer your-secret-key' \
--header 'tokenId: your-token-id' \
--header 'Content-Type: application/json' \
--data '{
"templateId": "669d25bf4be6e965914a9e3e",
"otherFields": [
{
"label": "Purpose of Visit",
"name": "purpose_of_visit",
"value": "Work"
}
],
"status": "open",
"participants": [
{
"roles": ["organiser", "admin"],
"account_id": "6627c83c122f76583c42ff10",
"accountType": "organisation",
"accountSnapshot": {
"name": "Test Adventures",
"displayPictureUrl": "c103be9234.jpeg"
},
"analytics": {
"gender": "male",
"age": 23,
"zipCode": "110030"
}
},
{
"roles": ["sharer", "admin"],
"account_id": "65dea5868910b6f5957a0fb5",
"accountType": "user",
"accountSnapshot": {
"name": "Rahul Sharma"
},
"sharedDocumentsIds": [
"65df7d42fdfc8d3689057d8e"
]
}
]
}'Only templateId, status and participants (with roles, account_id and accountType) are needed. otherFields, accountSnapshot, analytics and sharedDocumentsIds can be left out.
Participant fields
| Field | Description |
|---|---|
roles | Array of roles: organiser, admin, sharer |
account_id | qid account ID. Must be a valid ObjectId. |
accountType | user or organisation |
accountSnapshot | Snapshot of account details. Stored exactly as sent; the API does not fill it in from the account. |
sharedDocumentsIds | Document IDs shared by this participant |
analytics | Optional analytics metadata (gender, age, zipCode) |
Example response
Returns 201 Created with the new share. The share ID is in _id.
{
"deleteTime": null,
"schemaVersion": "3",
"participants": [
{
"roles": ["organiser", "admin"],
"account_id": "6627c83c122f76583c42ff10",
"accountType": "organisation",
"accountSnapshot": {
"name": "Test Adventures",
"displayPictureUrl": "c103be9234.jpeg"
},
"analytics": {
"gender": "male",
"age": 23,
"zipCode": "110030"
}
},
{
"roles": ["sharer", "admin"],
"account_id": "65dea5868910b6f5957a0fb5",
"accountType": "user",
"accountSnapshot": {
"name": "Rahul Sharma"
},
"sharedDocumentsIds": ["65df7d42fdfc8d3689057d8e"]
}
],
"otherFields": [
{
"label": "Purpose of Visit",
"name": "purpose_of_visit",
"value": "Work"
}
],
"template": "669d25bf4be6e965914a9e3e",
"isQuotaLocked": false,
"status": "open",
"agreements": [],
"updateLogs": [
{
"remark": "Share Started",
"updatedByAccount_id": "6627c83c122f76583c42ff10",
"updatedByAccountType": "organisation",
"updatedByAccountSnapshot": {
"name": "Cloud API - Test Key"
},
"updateTime": "2026-03-09T09:39:44.886Z"
}
],
"isPublicJoin": false,
"collectionRequestId": null,
"automations": [],
"webhookUrl": null,
"webhookSecret": null,
"webhookIdentifier": null,
"_id": "69ae9560ba7f6726e85f60ca",
"createTime": "2026-03-09T09:39:44.886Z",
"lastUpdateTime": "2026-03-09T09:39:44.886Z",
"__v": 0
}| Property | Type | Description |
|---|---|---|
_id | string | Share ID. Use it with Read Share. |
deleteTime | string | null | Deletion time, null for active shares |
schemaVersion | string | Share record schema version |
participants | Participant[] | Participants as sent in the request |
otherFields | Fields[] | Form fields as sent in the request ([] if omitted) |
template | string | Template ID. On create this is the plain ID; Read Share returns the template object. |
isQuotaLocked | boolean | Whether the share is quota locked |
status | string | Share status |
agreements | object[] | Accepted agreements ([] on create) |
updateLogs | object[] | Activity log. The first entry is Share Started, logged against the organisation that owns the API key. |
isPublicJoin | boolean | Whether the share can be joined publicly |
collectionRequestId | string | null | Linked collection request, null for shares created directly |
automations | string[] | Automations enabled for the share |
webhookUrl | string | null | Webhook URL for the share |
webhookSecret | string | null | Webhook secret |
webhookIdentifier | string | null | Webhook identifier |
createTime | string | Creation time (ISO 8601) |
lastUpdateTime | string | Last update time (ISO 8601) |
__v | number | Record version |
Errors
| Status | When | message |
|---|---|---|
400 | templateId missing or not an ObjectId | templateId must be a mongodb id |
400 | status missing | status must be a string |
400 | A participant account_id is not an ObjectId | participants.1.account_id must be a mongodb id |
400 | participants missing or empty | At least one participant is required to create a share |
400 | No participant has the organiser role | Organiser not found |
400 | Body is not valid JSON | JSON parser error text (this response has no requestId) |
401 | Authorization or tokenId header missing | Error: Token Missing |
401 | tokenId not recognised | HttpException: No record found with the provided Token ID |
500 | status is not open or completed (for example closed) | Internal server error |
Field validation errors include errorCode and error. When several fields fail, their messages are joined with , :
{
"statusCode": 400,
"errorCode": "Bad Request",
"error": "Bad Request",
"message": "templateId must be a mongodb id, status must be a string",
"timestamp": "2026-03-09T09:39:44.886Z",
"path": "/di/share",
"requestId": "3f2b8c1e-7d4a-4e9b-a1c6-5d8e2f0b9a71"
}Other errors leave out errorCode and error:
{
"statusCode": 400,
"message": "At least one participant is required to create a share",
"timestamp": "2026-03-09T09:39:44.886Z",
"path": "/di/share",
"requestId": "3f2b8c1e-7d4a-4e9b-a1c6-5d8e2f0b9a71"
}Note: The API does not check that
templateIdbelongs to an existing template or thataccountTypeisuserororganisation. A share created with an unknown template ID returns"template": nullfrom Read Share.
Updated 17 days ago
Did this page help you?