Back to arky.io

Business

Manage business settings, subscriptions, and team invitations

The Business module handles business configuration, subscription management, team invitations, and webhooks.

Get Business

GET /v1/businesses/{businessId}
SDK: sdk.business.getBusiness()

Retrieve the current business.

const business = await sdk.business.getBusiness({});

console.log(business.key, business.settings);

List Businesses

GET /v1/businesses
SDK: sdk.business.getBusinesses()

List all businesses the current user has access to.

const result = await sdk.business.getBusinesses({
query: 'store',
isNetwork: false,
status: 'ACTIVE',
limit: 20,
cursor: null,
sortField: 'createdAt',
sortDirection: 'desc'
});

result.items.forEach(business => {
console.log(business.key);
});

Parameters

Name Type Description
query optional string Search query
isNetwork optional boolean Filter by network status
status optional DRAFT | ACTIVE | ARCHIVED Filter by status
limit optional number Items per page
cursor optional string Pagination cursor
sortField optional string Sort field
sortDirection optional asc | desc Sort direction

Create Business

POST /v1/businesses
SDK: sdk.business.createBusiness()

Create a new business.

const result = await sdk.business.createBusiness({
key: 'my-store',
timezone: 'America/New_York',
billingEmail: 'billing@mystore.com',
languages: [{ id: 'en' }],
emails: {
  billing: 'billing@mystore.com',
  support: 'support@mystore.com'
}
});

Parameters

Name Type Description
key required string Unique business key identifier (min 3 chars, slug-format)
timezone required string IANA timezone, e.g. 'America/New_York'
billingEmail required string Billing contact email
languages optional Language[] Supported languages, e.g. `[{ id: 'en' }]`
emails optional BusinessEmails Billing and support emails

Three default markets are auto-created with every business: us (USD, Exclusive), eu (EUR, Inclusive), and booking (USD, Exclusive, no zones). Fetch them with sdk.market.list() or create additional markets with sdk.market.create().

Update Business

PUT /v1/businesses/{id}
SDK: sdk.business.updateBusiness()

Update business settings.

const result = await sdk.business.updateBusiness({
id: 'biz_abc123',
key: 'my-updated-store',
timezone: 'America/New_York',
languages: [{ id: 'en' }],
emails: {
  billing: 'billing@yourstore.com',
  support: 'support@yourstore.com'
}
});

Parameters

Name Type Description
id required string Business ID
key optional string Business key
timezone optional string Business timezone (IANA format)
languages optional Language[] Supported languages
emails optional BusinessEmails Billing and support emails

Delete Business

DELETE /v1/businesses/{id}
SDK: sdk.business.deleteBusiness()

Permanently delete a business and all associated data.

Warning

This action is irreversible. All products, orders, bookings, and content will be permanently deleted.

await sdk.business.deleteBusiness({
  id: 'biz_abc123'
});

Subscriptions

Get Subscription Plans

GET /v1/businesses/plans
SDK: sdk.business.getSubscriptionPlans()

List available subscription plans.

const plans = await sdk.business.getSubscriptionPlans({});

plans.forEach(plan => {
  console.log(plan.name, plan.price, plan.features);
});

Subscribe to Plan

PUT /v1/businesses/{businessId}/subscribe
SDK: sdk.business.subscribe()

Subscribe a business to a plan. Returns a Stripe checkout URL for payment.

const result = await sdk.business.subscribe({
planId: 'plan_pro',
successUrl: 'https://yourapp.com/subscription/success',
cancelUrl: 'https://yourapp.com/subscription/cancel'
});

// Redirect to Stripe checkout
if (result.url) {
window.location.href = result.url;
}

Parameters

Name Type Description
planId required string Plan ID to subscribe to
successUrl required string URL to redirect after successful payment
cancelUrl required string URL to redirect if payment is cancelled

Create Billing Portal Session

POST /v1/businesses/{businessId}/subscription/portal
SDK: sdk.business.createPortalSession()

Create a Stripe Customer Portal session for subscription management.

const result = await sdk.business.createPortalSession({
  returnUrl: 'https://yourapp.com/settings/billing'
});

// Redirect to Stripe portal
window.location.href = result.url;

Parameters

Name Type Description
returnUrl required string URL to return to after portal session

Team Management

Invite User

POST /v1/businesses/{businessId}/invitation
SDK: sdk.business.inviteUser()

Send an invitation to join the business team.

await sdk.business.inviteUser({
email: 'teammate@example.com',
role: 'Admin'  // 'Admin' | 'Owner' | 'Super'
});

Parameters

Name Type Description
email required string Invitee email address
role optional Admin | Owner | Super Role to assign (defaults to Admin)

Handle Invitation

PUT /v1/businesses/{businessId}/invitation
SDK: sdk.business.handleInvitation()

Accept or decline an invitation.

// Accept invitation
await sdk.business.handleInvitation({
token: 'invitation_token_from_email',
action: 'ACCEPT'
});

// Reject invitation
await sdk.business.handleInvitation({
token: 'invitation_token_from_email',
action: 'REJECT'
});

Parameters

Name Type Description
token required string Invitation token from email
action required ACCEPT | REJECT Action to take

Remove Member

DELETE /v1/businesses/{businessId}/members/{accountId}
SDK: sdk.business.removeMember()

Remove a team member from the business.

await sdk.business.removeMember({
  accountId: 'acc_abc123',
});

Parameters

Name Type Description
accountId required string Account ID of the member to remove

Webhooks

Test Webhook

POST /v1/businesses/{businessId}/webhooks/test
SDK: sdk.business.testWebhook()

Send a test webhook to verify your endpoint configuration.

await sdk.business.testWebhook({
webhook: {
  url: 'https://yourapp.com/webhooks',
  events: ['order.created', 'order.paid'],
  secret: 'whsec_...'
}
});

console.log('Webhook test sent successfully');

Parameters

Name Type Description
webhook required object Webhook configuration object with url, events, and optional secret

Media

Get Business Media

GET /v1/businesses/{id}/media
SDK: sdk.business.getBusinessMedia()

List all media files for a business.

const result = await sdk.business.getBusinessMedia({
  id: 'biz_abc123',
  limit: 50,
  cursor: null,
  query: 'product',
  mimeType: 'image/jpeg',
  sortField: 'createdAt',
  sortDirection: 'desc'
});

result.items.forEach(media => {
  console.log(media.id, media.url);
});

Parameters

Name Type Description
id required string Business ID
limit required number Items per page
cursor optional string Pagination cursor
ids optional string[] Filter by specific media IDs
query optional string Search query
mimeType optional string Filter by MIME type
sortField optional string Sort field
sortDirection optional asc | desc Sort direction

Refunds

Process Refund

POST /v1/businesses/{id}/refund
SDK: sdk.business.processRefund()

Process a refund for a payment.

await sdk.business.processRefund({
id: 'biz_abc123',
entity: 'ord_xyz789',  // Order or booking ID
amount: 1999  // Partial refund in cents
});

Parameters

Name Type Description
id required string Business ID
entity required string Order or booking ID to refund
amount required number Amount in cents to refund

Integrations

Manage third-party service integrations (Stripe, Shippo, Telegram, OpenAI, etc.).

List Integrations

GET /v1/businesses/{businessId}/integrations
SDK: sdk.business.listIntegrations()
const integrations = await sdk.business.listIntegrations({
  businessId: 'biz_abc123',
});

integrations.forEach(integration => {
  console.log(integration.key, integration.provider.type);
});

Create Integration

POST /v1/businesses/{businessId}/integrations
SDK: sdk.business.createIntegration()
// Stripe payment integration
await sdk.business.createIntegration({
  businessId: 'biz_abc123',
  key: 'stripe-payments',
  provider: {
    type: 'stripe',
    secretKey: 'sk_live_...',
    publishableKey: 'pk_live_...',
    webhookSecret: 'whsec_...',
    currency: 'USD',
    activeForCardPayments: true,
  },
});

// Telegram bot integration
await sdk.business.createIntegration({
  businessId: 'biz_abc123',
  key: 'support-telegram',
  provider: {
    type: 'telegram_bot',
    botToken: '123456:ABC...',
  },
});

Parameters

Name Type Description
businessId required string Business ID
key required string Unique integration key
provider required IntegrationProvider Provider configuration (type-specific fields)

Update Integration

PUT /v1/businesses/{businessId}/integrations/{id}
SDK: sdk.business.updateIntegration()
await sdk.business.updateIntegration({
  businessId: 'biz_abc123',
  id: 'int_xyz789',
  provider: {
    type: 'stripe',
    publishableKey: 'pk_live_new...',
    currency: 'EUR',
  },
});

Delete Integration

DELETE /v1/businesses/{businessId}/integrations/{id}
SDK: sdk.business.deleteIntegration()
await sdk.business.deleteIntegration({
  businessId: 'biz_abc123',
  id: 'int_xyz789',
});

Get Integration Config

GET /v1/businesses/{businessId}/integrations/config/{type}
SDK: sdk.business.getIntegrationConfig()

Get the active integration config for a specific category.

const paymentConfig = await sdk.business.getIntegrationConfig({
  businessId: 'biz_abc123',
  type: 'payment', // 'payment' | 'shipping' | 'analytics'
});

Available Provider Types

TypeCategoryKey Fields
stripePaymentsecretKey, publishableKey, webhookSecret, currency
shippoShippingapiToken, activeForFulfillment
googleOAuthclientId, clientSecret, scopes
google_analytics4AnalyticsmeasurementId, activeForTracking
telegram_botChannelbotToken, action
open_aiAIapiKey, model
deep_seekAIapiKey, model
resendEmailapiKey
send_gridEmailapiKey
slackMessagingapiKey
discordMessagingapiKey
whats_appMessagingapiKey
vercel_deploy_hookDeployurl
netlify_deploy_hookDeployurl
cloudflare_deploy_hookDeployurl
custom_deploy_hookDeployurl

Plus 20+ more API-key providers (Airtable, Linear, GitHub, Notion, HubSpot, etc.).

Channel Integrations

For messaging channels (telegram_bot), incoming messages are routed to AI agents that have the integration’s ID in their channelIds array. See AI Agents for setting up agent routing.


OAuth

Connect and disconnect OAuth providers (e.g. Google) for a business.

OAuth Connect

POST /v1/businesses/{businessId}/oauth/connect
SDK: sdk.business.oauthConnect()
await sdk.business.oauthConnect({
  businessId: 'biz_abc123',
  provider: 'google',
  code: 'auth_code_from_oauth_callback',
  redirectUri: 'https://yourapp.com/oauth/callback',
});

Parameters

Name Type Description
businessId required string Business ID
provider required string OAuth provider name
code required string Authorization code from OAuth callback
redirectUri required string Redirect URI used in the OAuth flow

OAuth Disconnect

POST /v1/businesses/{businessId}/oauth/disconnect
SDK: sdk.business.oauthDisconnect()
await sdk.business.oauthDisconnect({
  businessId: 'biz_abc123',
  provider: 'google',
});

Webhook CRUD

Manage webhook endpoints programmatically.

List Webhooks

GET /v1/businesses/{businessId}/webhooks
SDK: sdk.business.listWebhooks()
const webhooks = await sdk.business.listWebhooks({
  businessId: 'biz_abc123',
});

Create Webhook

POST /v1/businesses/{businessId}/webhooks
SDK: sdk.business.createWebhook()
await sdk.business.createWebhook({
  businessId: 'biz_abc123',
  key: 'order-notifications',
  url: 'https://yourapp.com/webhooks/orders',
  events: [
    { event: 'order.created' },
    { event: 'order.updated' },
  ],
  headers: { 'X-Custom-Header': 'value' },
  secret: 'whsec_my_secret',
  enabled: true,
});

Parameters

Name Type Description
businessId required string Business ID
key required string Unique webhook key
url required string Webhook endpoint URL
events required WebhookEventSubscription[] Events to subscribe to
headers required Record<string, string> Custom headers sent with each request
secret required string Signing secret for verifying webhook payloads
enabled required boolean Whether the webhook is active

Update Webhook

PUT /v1/businesses/{businessId}/webhooks/{id}
SDK: sdk.business.updateWebhook()
await sdk.business.updateWebhook({
  businessId: 'biz_abc123',
  id: 'wh_xyz789',
  key: 'order-notifications',
  url: 'https://yourapp.com/webhooks/v2/orders',
  events: [
    { event: 'order.created' },
    { event: 'order.updated' },
    { event: 'order.cancelled' },
  ],
  headers: {},
  secret: 'whsec_new_secret',
  enabled: true,
});

Delete Webhook

DELETE /v1/businesses/{businessId}/webhooks/{id}
SDK: sdk.business.deleteWebhook()
await sdk.business.deleteWebhook({
  businessId: 'biz_abc123',
  id: 'wh_xyz789',
});

Available Webhook Events

EventDescription
node.createdCMS node created
node.updatedCMS node updated
node.deletedCMS node deleted
form_submission.createdForm submission received
order.createdOrder created
order.updatedOrder status changed
booking.createdBooking created
booking.updatedBooking status changed
product.createdProduct created
product.updatedProduct updated
product.deletedProduct deleted
audience.subscriber_addedNew audience subscriber