Provision a community membership from an external sales funnel. Looks up / creates the user by email or telegramUserId, handles overlap with existing memberships, and is idempotent via externalOrderId.
Private access. This endpoint provisions paid access without a payment, so it is granted only to vetted partners. Request it from support@insy.io.
POST
/membership/provision-externalAuthorization
AuthorizationBearer token (API Key) · headerrequiredAPI Key for programmatic access (format: insy_xxxxx)
Request body
requiredapplication/jsoncommunityIdstring<uuid>requiredCommunity for which the membership is provisioned
emailstring<email>Email of the member. At least one of email or telegramUserId must be provided.
telegramUserIdnumberTelegram user id. At least one of email or telegramUserId must be provided.
min 1
pricingPlanIdstring<uuid>Pricing plan id the membership should be associated with
validFromstringMembership start, ISO-8601. Defaults to now.
validUntilstringMembership end, ISO-8601. Omit for lifetime membership.
externalOrderIdstringrequiredIdempotency key from the external system. Re-calling with the same externalOrderId returns the existing membership unchanged.
onOverlapstringBehavior when the user already has an active, non-expired membership for this community. Defaults to 'extend'.
default: "extend"
Allowed:
extendreplaceerrorResponses
200Successful response
successbooleanrequiredWhether the request was successful
errorCodestringrequiredThe error code returned by the request
Allowed:
not_foundbad_requestalready_existsunauthorizedforbiddeninternal_server_errorservice_unavailabletimeoutconflictprecondition_failedunprocessable_entitymessagestringrequiredThe message returned by the request
dataProvisionExternalMembershipResponseDtoShow propertiesHide properties
membershipIdstringrequireduserIdstringrequiredvalidFromstring<date-time>requiredvalidUntilstring<date-time> | nullrequiredstatusstringrequiredAllowed:
createdextendedreplacedidempotent_return401Invalid, expired, or revoked API key
403Insufficient API key permissions
Try it
Server
Authorization
Bodyapplication/json
Request
curl -X POST "https://api.insy.io/membership/provision-external" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"communityId": "123e4567-e89b-12d3-a456-426614174000",
"email": "user@example.com",
"telegramUserId": 1,
"pricingPlanId": "c93726f9-189f-4fc5-bad5-9d1f51ff93e2",
"validFrom": "string",
"validUntil": "string",
"externalOrderId": "string",
"onOverlap": "extend"
}'const response = await fetch("https://api.insy.io/membership/provision-external", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"communityId": "123e4567-e89b-12d3-a456-426614174000",
"email": "user@example.com",
"telegramUserId": 1,
"pricingPlanId": "c93726f9-189f-4fc5-bad5-9d1f51ff93e2",
"validFrom": "string",
"validUntil": "string",
"externalOrderId": "string",
"onOverlap": "extend"
})
});import requests
response = requests.post(
"https://api.insy.io/membership/provision-external",
headers={
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
json={
"communityId": "123e4567-e89b-12d3-a456-426614174000",
"email": "user@example.com",
"telegramUserId": 1,
"pricingPlanId": "c93726f9-189f-4fc5-bad5-9d1f51ff93e2",
"validFrom": "string",
"validUntil": "string",
"externalOrderId": "string",
"onOverlap": "extend"
},
)Response
{
"success": true,
"errorCode": "not_found",
"message": "Success",
"data": {
"membershipId": "string",
"userId": "string",
"validFrom": "2019-08-24T14:15:22Z",
"validUntil": "2019-08-24T14:15:22Z",
"status": "created"
}
}Invalid, expired, or revoked API key
Insufficient API key permissions