Shared views & forms API
Every Shared views & forms action (3) and data model (1): endpoints, scopes, input, preconditions, events and examples.
Share a Base view with a private link, or publish it as a form.
Module code data_sharing · 3 actions · 1 data models · 3 events. A key or token never does more here than the person behind it can; row-level security applies exactly as in the app. Scopes: data_sharing (everything), data_sharing:read (read only) or data_sharing:<capability>.
Resources
| Resource | Table | List and read | POST | PATCH | DELETE |
|---|---|---|---|---|---|
data_shares | data_share | /api/v1/data_shares |
Lists take limit (up to 200), cursor, order (e.g. -created_at), fields and q; every other query parameter is a column filter: ?status=paid, ?total[gte]=100, ?id[in]=a,b, ?x=null.
Actions
| Action | Needs | What it does |
|---|---|---|
data_sharing.create_link | data_sharing:manage | Share a view |
data_sharing.revoke_link | data_sharing:manage | Revoke a shared link |
data_sharing.update_link | data_sharing:manage | Change a shared link |
data_sharing.create_link
Share a view — Publishes a view on a secret link — read-only, or a form strangers can fill in.
Needs data_sharing:manage · changes data
https://app.getera.io/api/v1/data_shares/actions/create_link- Canonical address:
POST /api/v1/actions/data_sharing.create_link
Input
| Field | Type | Required | Notes |
|---|---|---|---|
savedViewId | uuid | yes | View · id of saved_view |
scope | string (enum) | yes | People with the link can · Allowed values: read, submit |
password | string | Password · max 200 | |
expiresAt | date-time | Expires | |
allowDownload | boolean | Allow CSV download |
Preconditions
The action is refused with 409 and one of these codes:
| Code | Refused when |
|---|---|
view_not_found | The view must be a Base view on this workspace. |
wrong_view_kind | Forms are shared to fill in; other views to read. |
form_not_built | A form view is shared once its form exists. |
password_too_short | A link password is at least six characters. |
expiry_in_past | A link has to expire in the future. |
Events it publishes: data_sharing.link_created
What it writes: data_share (insert) — Creates the link
curl -X POST https://app.getera.io/api/v1/data_shares/actions/create_link \
-H "Authorization: Bearer $ERA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"savedViewId":"SAVED_VIEW_ID","scope":"read"}'{
"ok": true,
"result": "…",
"events": [
"data_sharing.link_created"
]
}import { createEra } from "@getera/sdk"
const era = createEra({ apiKey: process.env.ERA_API_KEY })
const res = await era.dataShares.createLink({
savedViewId: "SAVED_VIEW_ID",
scope: "read"
})era data_shares create_link \
--saved-view-id "SAVED_VIEW_ID" \
--scope "read"{
"name": "era__data_sharing__create_link",
"arguments": {
"savedViewId": "SAVED_VIEW_ID",
"scope": "read"
}
}Errors: 401 no or expired credential · 403 the credential does not hold data_sharing:manage · 404 the record or module is outside what it may reach · 422 invalid input (problems[]) · 409 view_not_found, wrong_view_kind, form_not_built, password_too_short, expiry_in_past · 429 slow down
data_sharing.revoke_link
Revoke a shared link — The link stops working at once, for everyone who has it.
Needs data_sharing:manage · removes or cannot be undone · asks a person to confirm when Era runs it
https://app.getera.io/api/v1/data_shares/{id}/actions/revoke_link- Canonical address:
POST /api/v1/actions/data_sharing.revoke_link
Input
| Field | Type | Required | Notes |
|---|---|---|---|
id | uuid | yes | Filled from the path {id} · Link · id of data_share |
Preconditions
The action is refused with 409 and one of these codes:
| Code | Refused when |
|---|---|
link_not_found | The link must exist and still be live. |
Events it publishes: data_sharing.link_revoked
What it writes: data_share (update) — Switches the link off
curl -X POST https://app.getera.io/api/v1/data_shares/DATA_SHARE_ID/actions/revoke_link \
-H "Authorization: Bearer $ERA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{}'{
"ok": true,
"result": "…",
"events": [
"data_sharing.link_revoked"
]
}import { createEra } from "@getera/sdk"
const era = createEra({ apiKey: process.env.ERA_API_KEY })
const res = await era.dataShares.revokeLink("DATA_SHARE_ID")era data_shares revoke_link DATA_SHARE_ID{
"name": "era__data_sharing__revoke_link",
"arguments": {
"id": "DATA_SHARE_ID"
}
}Errors: 401 no or expired credential · 403 the credential does not hold data_sharing:manage · 404 the record or module is outside what it may reach · 422 invalid input (problems[]) · 409 link_not_found · 429 slow down
data_sharing.update_link
Change a shared link — Sets or removes its password and expiry, and whether it allows a download.
Needs data_sharing:manage · changes data
https://app.getera.io/api/v1/data_shares/{id}/actions/update_link- Canonical address:
POST /api/v1/actions/data_sharing.update_link
Input
| Field | Type | Required | Notes |
|---|---|---|---|
id | uuid | yes | Filled from the path {id} · Link · id of data_share |
password | string | New password · max 200 | |
removePassword | boolean | Remove the password | |
expiresAt | date-time | Expires | |
removeExpiry | boolean | Never expire | |
allowDownload | boolean | Allow CSV download |
Preconditions
The action is refused with 409 and one of these codes:
| Code | Refused when |
|---|---|
link_not_found | The link must exist and still be live. |
password_too_short | A link password is at least six characters. |
expiry_in_past | A link has to expire in the future. |
Events it publishes: data_sharing.link_changed
What it writes: data_share (update) — Changes the link
curl -X POST https://app.getera.io/api/v1/data_shares/DATA_SHARE_ID/actions/update_link \
-H "Authorization: Bearer $ERA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"password":"New password"}'{
"ok": true,
"result": "…",
"events": [
"data_sharing.link_changed"
]
}import { createEra } from "@getera/sdk"
const era = createEra({ apiKey: process.env.ERA_API_KEY })
const res = await era.dataShares.updateLink("DATA_SHARE_ID", {
password: "New password"
})era data_shares update_link DATA_SHARE_ID \
--password "New password"{
"name": "era__data_sharing__update_link",
"arguments": {
"id": "DATA_SHARE_ID",
"password": "New password"
}
}Errors: 401 no or expired credential · 403 the credential does not hold data_sharing:manage · 404 the record or module is outside what it may reach · 422 invalid input (problems[]) · 409 link_not_found, password_too_short, expiry_in_past · 429 slow down
Data models
DataShare
Table data_share · Resource data_shares
GET /api/v1/data_sharesGET /api/v1/data_shares/{id}
| Column | Type | Nullable | Allowed values | References |
|---|---|---|---|---|
id | string (uuid) · uuid | |||
organization_id | string (uuid) · uuid | organization | ||
workspace_id | string (uuid) · uuid | workspace | ||
data_table_id | string (uuid) · uuid | |||
saved_view_id | string (uuid) · uuid | |||
scope | string · text | read, submit | ||
expires_at | string (date-time) · timestamptz | yes | ||
allow_download | boolean · bool | |||
is_active | boolean · bool | |||
created_by | string (uuid) · uuid | app_user | ||
created_at | string (date-time) · timestamptz | |||
updated_at | string (date-time) · timestamptz |
Primary key: id
Unique: token
Events
Workflows and webhooks react to these events.
| Event | What happens | Payload |
|---|---|---|
data_sharing.link_changed | A shared link’s password or expiry changed. | id |
data_sharing.link_created | A view was shared on a link. | id, savedViewId, scope |
data_sharing.link_revoked | A shared link was switched off. | id |