curl -X POST 'https://api.example.com/memberships' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"subjectId": "sub_123",
"scopeId": "scope_456"
}'
const axios = require('axios');
const { data } = await axios.post('https://api.example.com/memberships', {
subjectId: 'sub_123',
scopeId: 'scope_456',
}, {
headers: { 'Authorization': 'Bearer YOUR_TOKEN' },
});
{
"id": "mem_789",
"subjectId": "sub_123",
"scopeId": "scope_456"
}
Memberships
Create Membership
Add a subject to a scope by creating a membership
POST
/
memberships
curl -X POST 'https://api.example.com/memberships' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"subjectId": "sub_123",
"scopeId": "scope_456"
}'
const axios = require('axios');
const { data } = await axios.post('https://api.example.com/memberships', {
subjectId: 'sub_123',
scopeId: 'scope_456',
}, {
headers: { 'Authorization': 'Bearer YOUR_TOKEN' },
});
{
"id": "mem_789",
"subjectId": "sub_123",
"scopeId": "scope_456"
}
Request Body
string
required
The subject ID to add to the scope
string
required
The scope ID to add the subject to
Response
Returns the created membership object.curl -X POST 'https://api.example.com/memberships' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"subjectId": "sub_123",
"scopeId": "scope_456"
}'
const axios = require('axios');
const { data } = await axios.post('https://api.example.com/memberships', {
subjectId: 'sub_123',
scopeId: 'scope_456',
}, {
headers: { 'Authorization': 'Bearer YOUR_TOKEN' },
});
{
"id": "mem_789",
"subjectId": "sub_123",
"scopeId": "scope_456"
}
Was this page helpful?
⌘I