Create Subscription
const url = 'https://api.foldspace.ai/v1/subscription';const options = { method: 'POST', headers: { 'X-FOLDSPACE-API-KEY': '<X-FOLDSPACE-API-KEY>', 'Content-Type': 'application/json' }, body: '{"identifyId":"subscription_1234","name":"Acme Org Subscription","domain":"acme.org","planId":"PLAN-123456","lastSeenDate":1734539909141,"customAttributes":{"additionalProperty":{}},"products":[{"product":"X7B69NRTTBM7","environment":1}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.foldspace.ai/v1/subscription \ --header 'Content-Type: application/json' \ --header 'X-FOLDSPACE-API-KEY: <X-FOLDSPACE-API-KEY>' \ --data '{ "identifyId": "subscription_1234", "name": "Acme Org Subscription", "domain": "acme.org", "planId": "PLAN-123456", "lastSeenDate": 1734539909141, "customAttributes": { "additionalProperty": {} }, "products": [ { "product": "X7B69NRTTBM7", "environment": 1 } ] }'Creates a new subscription.
Authorizations
Section titled “Authorizations ”Request Body required
Section titled “Request Body required ”DTO for creating a new subscription. identifyId is required.
Subscription Data Transfer Object
object
System-managed subscription ID (not updatable)
Unique identify ID for the subscription. Required during creation, not updatable.
Example
subscription_1234Subscription name
Example
Acme Org SubscriptionDomain associated with this subscription
Example
acme.orgPlan ID or SKU
Example
PLAN-123456Last seen date (epoch ms). Must be a positive value.
Example
1734539909141Last modified date (system-managed)
Custom attributes as map of key-value pairs
object
Custom attributes as map of key-value pairs
object
Products associated with this subscription (1=prod, 2=stage, 3=test, 4=dev)
Details about product and environment association
object
Product code
Example
X7B69NRTTBM7Environment code (1=prod, 2=stage, 3=test, 4=dev)
Example
1Responses
Section titled “ Responses ”Subscription created successfully
Example
{ "message": "Subscription created successfully"}Bad Request
Unauthorized
Rate limit exceeded for subscription
Example
{ "error": "Rate limit exceeded for subscription"}Internal server error