Managing organization identifiers & metadata
Applications often need to manage and track resources in their own systems. Scalekit provides two features to help with this:
- External IDs: Associate your own identifiers with organizations
- Metadata: Store custom key-value pairs with organizations
When to use external IDs and metadata
Section titled “When to use external IDs and metadata”Use these features when you need to:
- Track organizations using your own identifiers instead of Scalekit’s IDs
- Store additional information about organizations like billing details or internal codes
- Integrate Scalekit organizations with your existing systems
Add an external ID to an organization
Section titled “Add an external ID to an organization”External IDs let you identify organizations using your own identifiers. You can set an external ID when creating or updating an organization.
Create a new organization with an external ID
Section titled “Create a new organization with an external ID”This example shows how to create an organization with your custom identifier:
curl https://<SCALEKIT_ENVIRONMENT_URL>/api/v1/organizations \ --request POST \ --header 'Content-Type: application/json' \ --data '{ "display_name": "Megasoft Inc", "external_id": "CUST-12345-MGSFT",}'
Update an existing organization’s external ID
Section titled “Update an existing organization’s external ID”To change an organization’s external ID, use the update endpoint:
curl 'https://<SCALEKIT_ENVIRONMENT_URL>/api/v1/organizations/{id}' \ --request PATCH \ --header 'Content-Type: application/json' \ --data '{ "display_name": "Megasoft Inc", "external_id": "TENANT-12345-MGSFT",}'
Add metadata to an organization
Section titled “Add metadata to an organization”Metadata lets you store custom information as key-value pairs. You can add metadata when creating or updating an organization.
Create a new organization with metadata
Section titled “Create a new organization with metadata”This example shows how to store billing information with a new organization:
curl https://<SCALEKIT_ENVIRONMENT_URL>/api/v1/organizations \ --request POST \ --header 'Content-Type: application/json' \ --data '{ "display_name": "Megasoft Inc", "metadata": { "invoice_email": "invoices@megasoft.com" }}'
Update an existing organization’s metadata
Section titled “Update an existing organization’s metadata”To modify an organization’s metadata, use the update endpoint:
curl 'https://<SCALEKIT_ENVIRONMENT_URL>/api/v1/organizations/{id}' \ --request PATCH \ --header 'Content-Type: application/json' \ --data '{ "display_name": "Megasoft Inc", "metadata": { "invoice_email": "billing@megasoft.com" }}'
View external IDs and metadata
Section titled “View external IDs and metadata”All organization endpoints that return organization details will include the external ID and metadata in their responses. This makes it easy to access your custom data when working with organizations.