Sharing API
- Base URL:
https://sharing-api.sls.epilot.io - Full API Docs: https://docs.epilot.io/api/sharing
Usageโ
import { epilot } from '@epilot/sdk'
epilot.authorize(() => '<token>')
const { data } = await epilot.sharing.getSharingConfiguration(...)
Tree-shakeable importโ
import { getClient, authorize } from '@epilot/sdk/sharing'
const sharingClient = getClient()
authorize(sharingClient, () => '<token>')
const { data } = await sharingClient.getSharingConfiguration(...)
Operationsโ
Sharing Configuration
getSharingConfigurationupdateSharingConfigurationdeleteSharingConfigurationassignRoleToConfigurationgetSharingConfigurationssearchPartnerSharingConfigurationsgetConfigurationsByTemplateRole
Entity Sharing
Entity Offering
Schemas
PartnerSharingConfigPartnerStatusEntityResourceOfferEntityResourceTemplateRoleGrantOfferStatusPartialEntityOfferStatusEnumEntityResourceInputOfferEntityResourceInputUpdateSharingConfigurationPayloadAssignRolePayloadSearchSharingConfigurationsPayloadSharingEntityPayloadPartnerEntitiesInputShareChildEntityPayloadPartnerEntityInputOfferEntityPayloadPartnerOfferedEntitiesInputAcceptOfferPayload
getSharingConfigurationโ
Get sharing configuration for a partner
GET /v1/sharing/configurations/{partner_org_id}
const { data } = await client.getSharingConfiguration({
partner_org_id: 'example',
})
Response
{
"sharing_org_id": "string",
"partner_org_id": "string",
"users": ["string"],
"partner_status": "REGISTERED",
"entities": [
{
"schema": "string",
"entity_id": "string",
"parent_entity_id": "string",
"offer_accepted": true,
"updated_at": "string",
"created_at": "string"
}
],
"offered_entities": [
{
"schema": "string",
"entity_id": "string",
"parent_entity_id": "string",
"offer_status": "EXPIRED",
"offered_by_user_id": "string",
"updated_at": "string",
"created_at": "string"
}
],
"template_role_id": "string",
"template_role_grants": [
{
"action": "string",
"resource": "string",
"effect": "string"
}
],
"generated_role_id": "string",
"user_limit": 0,
"created_at": "string",
"updated_at": "string"
}
updateSharingConfigurationโ
Update sharing configuration for a partner
PATCH /v1/sharing/configurations/{partner_org_id}
const { data } = await client.updateSharingConfiguration(
{
partner_org_id: 'example',
},
{
user_limit: 0
},
)
Response
{
"sharing_org_id": "string",
"partner_org_id": "string",
"users": ["string"],
"partner_status": "REGISTERED",
"entities": [
{
"schema": "string",
"entity_id": "string",
"parent_entity_id": "string",
"offer_accepted": true,
"updated_at": "string",
"created_at": "string"
}
],
"offered_entities": [
{
"schema": "string",
"entity_id": "string",
"parent_entity_id": "string",
"offer_status": "EXPIRED",
"offered_by_user_id": "string",
"updated_at": "string",
"created_at": "string"
}
],
"template_role_id": "string",
"template_role_grants": [
{
"action": "string",
"resource": "string",
"effect": "string"
}
],
"generated_role_id": "string",
"user_limit": 0,
"created_at": "string",
"updated_at": "string"
}
deleteSharingConfigurationโ
Delete sharing configuration for a partner
DELETE /v1/sharing/configurations/{partner_org_id}
const { data } = await client.deleteSharingConfiguration({
partner_org_id: 'example',
})
Response
{
"sharing_org_id": "string",
"partner_org_id": "string",
"users": ["string"],
"partner_status": "REGISTERED",
"entities": [
{
"schema": "string",
"entity_id": "string",
"parent_entity_id": "string",
"offer_accepted": true,
"updated_at": "string",
"created_at": "string"
}
],
"offered_entities": [
{
"schema": "string",
"entity_id": "string",
"parent_entity_id": "string",
"offer_status": "EXPIRED",
"offered_by_user_id": "string",
"updated_at": "string",
"created_at": "string"
}
],
"template_role_id": "string",
"template_role_grants": [
{
"action": "string",
"resource": "string",
"effect": "string"
}
],
"generated_role_id": "string",
"user_limit": 0,
"created_at": "string",
"updated_at": "string"
}
assignRoleToConfigurationโ
Assign a template role to a partner sharing configuration
PUT /v1/sharing/configurations/{partner_org_id}/role
const { data } = await client.assignRoleToConfiguration(
{
partner_org_id: 'example',
},
{
template_role_id: 'string'
},
)
Response
{
"sharing_org_id": "string",
"partner_org_id": "string",
"users": ["string"],
"partner_status": "REGISTERED",
"entities": [
{
"schema": "string",
"entity_id": "string",
"parent_entity_id": "string",
"offer_accepted": true,
"updated_at": "string",
"created_at": "string"
}
],
"offered_entities": [
{
"schema": "string",
"entity_id": "string",
"parent_entity_id": "string",
"offer_status": "EXPIRED",
"offered_by_user_id": "string",
"updated_at": "string",
"created_at": "string"
}
],
"template_role_id": "string",
"template_role_grants": [
{
"action": "string",
"resource": "string",
"effect": "string"
}
],
"generated_role_id": "string",
"user_limit": 0,
"created_at": "string",
"updated_at": "string"
}
getSharingConfigurationsโ
Get sharing configurations for multiple partners
GET /v1/sharing/configurations
const { data } = await client.getSharingConfigurations({
partner_org_ids: ['...'],
})
Response
[
{
"sharing_org_id": "string",
"partner_org_id": "string",
"users": ["string"],
"partner_status": "REGISTERED",
"entities": [
{
"schema": "string",
"entity_id": "string",
"parent_entity_id": "string",
"offer_accepted": true,
"updated_at": "string",
"created_at": "string"
}
],
"offered_entities": [
{
"schema": "string",
"entity_id": "string",
"parent_entity_id": "string",
"offer_status": "EXPIRED",
"offered_by_user_id": "string",
"updated_at": "string",
"created_at": "string"
}
],
"template_role_id": "string",
"template_role_grants": [
{
"action": "string",
"resource": "string",
"effect": "string"
}
],
"generated_role_id": "string",
"user_limit": 0,
"created_at": "string",
"updated_at": "string"
}
]
searchPartnerSharingConfigurationsโ
Search partner sharing configurations by entities
POST /v1/sharing/configurations:search
const { data } = await client.searchPartnerSharingConfigurations(
null,
{
entities: [
{
schema: 'string',
entity_id: 'string',
parent_entity_id: 'string',
offer_accepted: true
}
]
},
)
Response
[
{
"sharing_org_id": "string",
"partner_org_id": "string",
"users": ["string"],
"partner_status": "REGISTERED",
"entities": [
{
"schema": "string",
"entity_id": "string",
"parent_entity_id": "string",
"offer_accepted": true,
"updated_at": "string",
"created_at": "string"
}
],
"offered_entities": [
{
"schema": "string",
"entity_id": "string",
"parent_entity_id": "string",
"offer_status": "EXPIRED",
"offered_by_user_id": "string",
"updated_at": "string",
"created_at": "string"
}
],
"template_role_id": "string",
"template_role_grants": [
{
"action": "string",
"resource": "string",
"effect": "string"
}
],
"generated_role_id": "string",
"user_limit": 0,
"created_at": "string",
"updated_at": "string"
}
]
getConfigurationsByTemplateRoleโ
Get sharing configurations that use a specific template role
GET /v1/sharing/configurations/by-role/{template_role_id}
const { data } = await client.getConfigurationsByTemplateRole({
template_role_id: 'example',
})
Response
[
{
"sharing_org_id": "string",
"partner_org_id": "string",
"users": ["string"],
"partner_status": "REGISTERED",
"entities": [
{
"schema": "string",
"entity_id": "string",
"parent_entity_id": "string",
"offer_accepted": true,
"updated_at": "string",
"created_at": "string"
}
],
"offered_entities": [
{
"schema": "string",
"entity_id": "string",
"parent_entity_id": "string",
"offer_status": "EXPIRED",
"offered_by_user_id": "string",
"updated_at": "string",
"created_at": "string"
}
],
"template_role_id": "string",
"template_role_grants": [
{
"action": "string",
"resource": "string",
"effect": "string"
}
],
"generated_role_id": "string",
"user_limit": 0,
"created_at": "string",
"updated_at": "string"
}
]
shareEntityWithPartnersโ
Share or unshare entities with partners
POST /v1/sharing/entities:share
const { data } = await client.shareEntityWithPartners(
null,
{
share: [
{
partner_org_id: 'string',
entities: [
{
schema: 'string',
entity_id: 'string',
parent_entity_id: 'string',
offer_accepted: true
}
]
}
],
unshare: [
{
partner_org_id: 'string',
entities: [
{
schema: 'string',
entity_id: 'string',
parent_entity_id: 'string',
offer_accepted: true
}
]
}
]
},
)
Response
[
{
"sharing_org_id": "string",
"partner_org_id": "string",
"users": ["string"],
"partner_status": "REGISTERED",
"entities": [
{
"schema": "string",
"entity_id": "string",
"parent_entity_id": "string",
"offer_accepted": true,
"updated_at": "string",
"created_at": "string"
}
],
"offered_entities": [
{
"schema": "string",
"entity_id": "string",
"parent_entity_id": "string",
"offer_status": "EXPIRED",
"offered_by_user_id": "string",
"updated_at": "string",
"created_at": "string"
}
],
"template_role_id": "string",
"template_role_grants": [
{
"action": "string",
"resource": "string",
"effect": "string"
}
],
"generated_role_id": "string",
"user_limit": 0,
"created_at": "string",
"updated_at": "string"
}
]
shareChildEntityWithPartnersโ
Share or unshare child entities with partners
POST /v1/sharing/entities:share-child
const { data } = await client.shareChildEntityWithPartners(
null,
{
share: [
{
entity: {
schema: 'string',
entity_id: 'string',
parent_entity_id: 'string',
offer_accepted: true
},
partner_org_id: 'string'
}
],
unshare: [
{
entity: {
schema: 'string',
entity_id: 'string',
parent_entity_id: 'string',
offer_accepted: true
},
partner_org_id: 'string'
}
]
},
)
Response
[
{
"sharing_org_id": "string",
"partner_org_id": "string",
"users": ["string"],
"partner_status": "REGISTERED",
"entities": [
{
"schema": "string",
"entity_id": "string",
"parent_entity_id": "string",
"offer_accepted": true,
"updated_at": "string",
"created_at": "string"
}
],
"offered_entities": [
{
"schema": "string",
"entity_id": "string",
"parent_entity_id": "string",
"offer_status": "EXPIRED",
"offered_by_user_id": "string",
"updated_at": "string",
"created_at": "string"
}
],
"template_role_id": "string",
"template_role_grants": [
{
"action": "string",
"resource": "string",
"effect": "string"
}
],
"generated_role_id": "string",
"user_limit": 0,
"created_at": "string",
"updated_at": "string"
}
]
offerEntityToPartnersโ
Offer or unoffer entities to partners (First Come First Served)
POST /v1/sharing/entities:offer
const { data } = await client.offerEntityToPartners(
null,
{
offer: [
{
partner_org_id: 'string',
offered_entities: [
{
schema: 'string',
entity_id: 'string',
parent_entity_id: 'string'
}
]
}
],
unoffer: [
{
partner_org_id: 'string',
offered_entities: [
{
schema: 'string',
entity_id: 'string',
parent_entity_id: 'string'
}
]
}
]
},
)
Response
[
{
"sharing_org_id": "string",
"partner_org_id": "string",
"users": ["string"],
"partner_status": "REGISTERED",
"entities": [
{
"schema": "string",
"entity_id": "string",
"parent_entity_id": "string",
"offer_accepted": true,
"updated_at": "string",
"created_at": "string"
}
],
"offered_entities": [
{
"schema": "string",
"entity_id": "string",
"parent_entity_id": "string",
"offer_status": "EXPIRED",
"offered_by_user_id": "string",
"updated_at": "string",
"created_at": "string"
}
],
"template_role_id": "string",
"template_role_grants": [
{
"action": "string",
"resource": "string",
"effect": "string"
}
],
"generated_role_id": "string",
"user_limit": 0,
"created_at": "string",
"updated_at": "string"
}
]
getOfferStatusโ
Get the status of an entity offer (public, no auth required)
GET /v1/sharing/offers/status
const { data } = await client.getOfferStatus({
partner_org_id: 'example',
sharing_org_id: 'example',
entity_id: 'example',
})
Response
{
"entity": {
"_schema": "string",
"_id": "string",
"_title": "string",
"_created_at": "string",
"_updated_at": "string"
},
"offer_status": "EXPIRED",
"status_changed_at": "string",
"offered_at": "string",
"accepted_by_org_id": "string"
}
acceptOfferโ
Accept an entity offer (public, no auth required)
POST /v1/sharing/offers:accept
const { data } = await client.acceptOffer(
null,
{
partner_org_id: 'string',
sharing_org_id: 'string',
entity_id: 'string'
},
)
Response
{
"sharing_org_id": "string",
"partner_org_id": "string",
"users": ["string"],
"partner_status": "REGISTERED",
"entities": [
{
"schema": "string",
"entity_id": "string",
"parent_entity_id": "string",
"offer_accepted": true,
"updated_at": "string",
"created_at": "string"
}
],
"offered_entities": [
{
"schema": "string",
"entity_id": "string",
"parent_entity_id": "string",
"offer_status": "EXPIRED",
"offered_by_user_id": "string",
"updated_at": "string",
"created_at": "string"
}
],
"template_role_id": "string",
"template_role_grants": [
{
"action": "string",
"resource": "string",
"effect": "string"
}
],
"generated_role_id": "string",
"user_limit": 0,
"created_at": "string",
"updated_at": "string"
}
Schemasโ
PartnerSharingConfigโ
type PartnerSharingConfig = {
sharing_org_id: string
partner_org_id: string
users?: string[]
partner_status?: "REGISTERED" | "UNREGISTERED"
entities?: Array<{
schema: string
entity_id: string
parent_entity_id?: string
offer_accepted?: boolean
updated_at?: string
created_at?: string
}>
offered_entities?: Array<{
schema: string
entity_id: string
parent_entity_id?: string
offer_status: "EXPIRED" | "UNAVAILABLE" | "PENDING" | "DECLINED" | "ACCEPTED"
offered_by_user_id?: string
updated_at?: string
created_at?: string
}>
template_role_id?: string
template_role_grants?: Array<{
action: string
resource: string
effect?: string
}>
generated_role_id?: string
user_limit?: number
created_at?: string
updated_at?: string
}
PartnerStatusโ
type PartnerStatus = "REGISTERED" | "UNREGISTERED"
EntityResourceโ
type EntityResource = {
schema: string
entity_id: string
parent_entity_id?: string
offer_accepted?: boolean
updated_at?: string
created_at?: string
}
OfferEntityResourceโ
type OfferEntityResource = {
schema: string
entity_id: string
parent_entity_id?: string
offer_status: "EXPIRED" | "UNAVAILABLE" | "PENDING" | "DECLINED" | "ACCEPTED"
offered_by_user_id?: string
updated_at?: string
created_at?: string
}
TemplateRoleGrantโ
type TemplateRoleGrant = {
action: string
resource: string
effect?: string
}
OfferStatusโ
type OfferStatus = {
entity: {
_schema: string
_id: string
_title: string
_created_at: string
_updated_at: string
}
offer_status: "EXPIRED" | "UNAVAILABLE" | "PENDING" | "DECLINED" | "ACCEPTED"
status_changed_at?: string
offered_at?: string
accepted_by_org_id?: string
}
PartialEntityโ
type PartialEntity = {
_schema: string
_id: string
_title: string
_created_at: string
_updated_at: string
}
OfferStatusEnumโ
type OfferStatusEnum = "EXPIRED" | "UNAVAILABLE" | "PENDING" | "DECLINED" | "ACCEPTED"
EntityResourceInputโ
type EntityResourceInput = {
schema: string
entity_id: string
parent_entity_id?: string
offer_accepted?: boolean
}
OfferEntityResourceInputโ
type OfferEntityResourceInput = {
schema: string
entity_id: string
parent_entity_id?: string
}
UpdateSharingConfigurationPayloadโ
type UpdateSharingConfigurationPayload = {
user_limit?: number
}
AssignRolePayloadโ
type AssignRolePayload = {
template_role_id: string
}
SearchSharingConfigurationsPayloadโ
type SearchSharingConfigurationsPayload = {
entities: Array<{
schema: string
entity_id: string
parent_entity_id?: string
offer_accepted?: boolean
}>
}
SharingEntityPayloadโ
type SharingEntityPayload = {
share: Array<{
partner_org_id: string
entities: Array<{
schema: { ... }
entity_id: { ... }
parent_entity_id?: { ... }
offer_accepted?: { ... }
}>
}>
unshare: Array<{
partner_org_id: string
entities: Array<{
schema: { ... }
entity_id: { ... }
parent_entity_id?: { ... }
offer_accepted?: { ... }
}>
}>
}
PartnerEntitiesInputโ
type PartnerEntitiesInput = {
partner_org_id: string
entities: Array<{
schema: string
entity_id: string
parent_entity_id?: string
offer_accepted?: boolean
}>
}
ShareChildEntityPayloadโ
type ShareChildEntityPayload = {
share: Array<{
entity: {
schema: { ... }
entity_id: { ... }
parent_entity_id?: { ... }
offer_accepted?: { ... }
}
partner_org_id: string
}>
unshare: Array<{
entity: {
schema: { ... }
entity_id: { ... }
parent_entity_id?: { ... }
offer_accepted?: { ... }
}
partner_org_id: string
}>
}
PartnerEntityInputโ
type PartnerEntityInput = {
entity: {
schema: string
entity_id: string
parent_entity_id?: string
offer_accepted?: boolean
}
partner_org_id: string
}
OfferEntityPayloadโ
type OfferEntityPayload = {
offer: Array<{
partner_org_id: string
offered_entities: Array<{
schema: { ... }
entity_id: { ... }
parent_entity_id?: { ... }
}>
}>
unoffer: Array<{
partner_org_id: string
offered_entities: Array<{
schema: { ... }
entity_id: { ... }
parent_entity_id?: { ... }
}>
}>
}
PartnerOfferedEntitiesInputโ
type PartnerOfferedEntitiesInput = {
partner_org_id: string
offered_entities: Array<{
schema: string
entity_id: string
parent_entity_id?: string
}>
}
AcceptOfferPayloadโ
type AcceptOfferPayload = {
partner_org_id: string
sharing_org_id: string
entity_id: string
}