curl --request POST \
--url https://api.gumnut.ai/api/libraries/invitations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"library_id": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"max_joiners": 50
}
'import requests
url = "https://api.gumnut.ai/api/libraries/invitations"
payload = {
"library_id": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"max_joiners": 50
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({library_id: '<string>', expires_at: '2023-11-07T05:31:56Z', max_joiners: 50})
};
fetch('https://api.gumnut.ai/api/libraries/invitations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gumnut.ai/api/libraries/invitations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'library_id' => '<string>',
'expires_at' => '2023-11-07T05:31:56Z',
'max_joiners' => 50
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.gumnut.ai/api/libraries/invitations"
payload := strings.NewReader("{\n \"library_id\": \"<string>\",\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"max_joiners\": 50\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.gumnut.ai/api/libraries/invitations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"library_id\": \"<string>\",\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"max_joiners\": 50\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gumnut.ai/api/libraries/invitations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"library_id\": \"<string>\",\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"max_joiners\": 50\n}"
response = http.request(request)
puts response.read_body{
"invitation": {
"id": "<string>",
"library_id": "<string>",
"created_by": {
"id": "<string>",
"display_name": "<string>"
},
"role": "viewer",
"expires_at": "2023-11-07T05:31:56Z",
"max_joiners": 123,
"joiner_count": 123,
"remaining_places": 123,
"state": "active",
"disabled_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"url": "<string>"
}{
"invitation": {
"id": "<string>",
"library_id": "<string>",
"created_by": {
"id": "<string>",
"display_name": "<string>"
},
"role": "viewer",
"expires_at": "2023-11-07T05:31:56Z",
"max_joiners": 123,
"joiner_count": 123,
"remaining_places": 123,
"state": "active",
"disabled_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"url": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>",
"code": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}Create a library invitation
Issue an invitation for one library. An identical active policy returns the same link with 200; a new policy returns 201. A matching inactive invitation returns 409 without a link; retry with a new policy. Admission disabled returns 503; retry after it becomes available.
curl --request POST \
--url https://api.gumnut.ai/api/libraries/invitations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"library_id": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"max_joiners": 50
}
'import requests
url = "https://api.gumnut.ai/api/libraries/invitations"
payload = {
"library_id": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"max_joiners": 50
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({library_id: '<string>', expires_at: '2023-11-07T05:31:56Z', max_joiners: 50})
};
fetch('https://api.gumnut.ai/api/libraries/invitations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gumnut.ai/api/libraries/invitations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'library_id' => '<string>',
'expires_at' => '2023-11-07T05:31:56Z',
'max_joiners' => 50
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.gumnut.ai/api/libraries/invitations"
payload := strings.NewReader("{\n \"library_id\": \"<string>\",\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"max_joiners\": 50\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.gumnut.ai/api/libraries/invitations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"library_id\": \"<string>\",\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"max_joiners\": 50\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gumnut.ai/api/libraries/invitations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"library_id\": \"<string>\",\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"max_joiners\": 50\n}"
response = http.request(request)
puts response.read_body{
"invitation": {
"id": "<string>",
"library_id": "<string>",
"created_by": {
"id": "<string>",
"display_name": "<string>"
},
"role": "viewer",
"expires_at": "2023-11-07T05:31:56Z",
"max_joiners": 123,
"joiner_count": 123,
"remaining_places": 123,
"state": "active",
"disabled_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"url": "<string>"
}{
"invitation": {
"id": "<string>",
"library_id": "<string>",
"created_by": {
"id": "<string>",
"display_name": "<string>"
},
"role": "viewer",
"expires_at": "2023-11-07T05:31:56Z",
"max_joiners": 123,
"joiner_count": 123,
"remaining_places": 123,
"state": "active",
"disabled_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"url": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>",
"code": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}Authorizations
First-party Gumnut app session (Clerk session JWT). Only the Gumnut web and mobile apps can obtain one — API keys and OAuth tokens cannot manage credentials or library sharing, so these operations are not callable with the credentials this API otherwise accepts.
Body
ID of the single library this invitation targets.
Role offered to admitted members.
viewer, collaborator Absolute expiration instant with a timezone offset; must be in the future.
Maximum number of distinct accounts that can redeem this invitation.
1 <= x <= 100