Create a share link
Creates, or returns the existing, tracked share link (/s/<token>) for one of the company’s resources, the way a rep shares from the mobile app. Visiting the link redirects to the resource on the storefront with the share’s tracking parameters (share_token, utm_source=fluid, utm_medium=share, utm_campaign and utm_content), credited to the sharer.
Name the resource with relateable_type and relateable_id, or with the older medium_id or product_id. relateable_type is one of medium, product, page, promotion, library, enrollmentpack, mysite (the rep’s own mysite; no id) or site.
Without contact_id the link is a general link. With contact_id it is a smart link for that contact, and a visit through it is attributed to the contact. A smart link’s redirect also carries fluid_c, the contact’s token, except for a site: the site’s own code can read its address, so a site link leaves the token out, and its share_token attributes the visit. A site takes only one of the sharer’s own contacts in the company; any other contact_id, another rep’s contact included, returns 422 Contact not found.
A site must be public and published on the sites gateway. A private site, a draft, or a company not on the gateway returns 422. Its link redirects to /<sharer username>/sites/<site>, or to /home/sites/<site> (crediting the site’s owner) for a sharer with no member.
Asking again for the same user, resource and contact returns the same link.
curl --request POST \
--url https://api.fluid.app/api/shares \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"relateable_type": "site",
"relateable_id": 4821
}
'{
"id": 88501,
"relateable_id": 4821,
"relateable_type": "MemberSite",
"link": "https://dunder-mifflin.fluid.app/s/a1b2c3",
"token": "a1b2c3",
"views": 0,
"sample": false,
"user_id": 30411,
"contact_id": 90117,
"redirect": "https://dunder-mifflin.fluid.app/jim-halpert/sites/scranton-branch?share_token=a1b2c3&utm_campaign=site&utm_content=scranton-branch&utm_medium=share&utm_source=fluid"
}{
"message": "Invalid credentials."
}{
"message": "Only a public, published site can be shared"
}Authorizations
Bearer token authentication
Body
The resource to share and, for a smart link, the contact.
The kind of resource: medium, product, page, promotion, library, enrollmentpack, mysite or site. Case-insensitive.
"site"
The resource's ID. Not used for mysite.
4821
Shorthand for relateable_type=medium with this ID.
"55210"
Shorthand for relateable_type=product with this ID.
"30117"
A contact to make a smart link for. Omit it for a general link.
90117
Whether the link activates sample pricing. Ignored for a site.
false
Accepted and ignored.
Response
The share link.
A share link.
The share's ID.
The tracked link to hand out.
The link's token.
The shared resource's ID.
The shared resource's type, such as Medium or MemberSite.
Visits through the link.
Whether the link activates sample pricing.
The sharer's user ID.
The smart link's contact, or null for a general link.
Where the link sends a visitor now, with its tracking parameters, or null when the resource has no destination.
curl --request POST \
--url https://api.fluid.app/api/shares \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"relateable_type": "site",
"relateable_id": 4821
}
'{
"id": 88501,
"relateable_id": 4821,
"relateable_type": "MemberSite",
"link": "https://dunder-mifflin.fluid.app/s/a1b2c3",
"token": "a1b2c3",
"views": 0,
"sample": false,
"user_id": 30411,
"contact_id": 90117,
"redirect": "https://dunder-mifflin.fluid.app/jim-halpert/sites/scranton-branch?share_token=a1b2c3&utm_campaign=site&utm_content=scranton-branch&utm_medium=share&utm_source=fluid"
}{
"message": "Invalid credentials."
}{
"message": "Only a public, published site can be shared"
}