Skip to main content
Connector guides

Connect AFI Backup

Afi is a SaaS backup platform for Microsoft 365, Google Workspace, Salesforce, Microsoft Azure and AWS. An MSP uses it to back up each customer tenant under one Afi organization. StackJack connects an…

Written By Christopher Scaminaci

Last updated About 2 hours ago

Afi is a SaaS backup platform for Microsoft 365, Google Workspace, Salesforce, Microsoft Azure and AWS. An MSP uses it to back up each customer tenant under one Afi organization. StackJack connects an AI assistant to Afi's public API.

Connecting AFI Backup to StackJack gives your AI assistant a family of afi_ MCP tools. MCP (Model Context Protocol) tools are the standardized commands an AI assistant can call through StackJack. With them, your AI can:

  • Find what the app reaches - the organizations and tenants where your Afi app is installed, child organizations, and each tenant's usage and quotas
  • Check protection - the resources of a tenant, which backup policy protects each one, and protection statistics by resource kind
  • Follow backup work - read a task and count tasks by status over a period, and read the tenant's audit events
  • Read licensing - the subscriptions of an organization and their usage history
  • Act (on Pro plans) - protect or unprotect a resource, run a job now, schedule an archive for deletion, and create a child organization

The Afi API manages and reports on backups. It never returns backup data itself.

How StackJack authenticates to Afi

Afi uses apps. An app has a set of roles and up to two API keys. StackJack sends the key with every call; there is nothing to sign in to and no token to refresh.

Creating the app and its key

  1. Sign in to the Afi portal and open Configuration, then the Apps tab (an organization-wide app). A tenant-level app is under Service, then Settings, then Apps.

  2. Click Create app. Give it a name and choose its roles:

    • Read configuration for every read tool.
    • Write configuration to protect and unprotect resources and to run jobs.
    • Manage data to delete archives.
    • Billing access to read licensing.

    Afi does not let you change an app's roles after it is created, so choose every role you will want now.

  3. Install the app in your organization (or in each tenant it should reach). An organization-wide app reaches every tenant under the Afi organization where it is installed.

  4. Edit the app and click Generate key in the Keys section. Copy the key right away: Afi stores only a hash of it and cannot show it again.

Connect it in StackJack

  1. Open Connectors, then AFI Backup.
  2. Paste the API key. The address is fixed, so there is nothing else to enter.
  3. Click Test connection. StackJack reads the list of the app's installations, which changes nothing.

Paste the key again whenever you save the connection, including when you only rename it.

What is worth knowing before you start

Start with the installations

afi_list_app_installations lists every organization and tenant where the app is installed. Every other tool takes one of those ids. A multi-geo Microsoft 365 or Google Workspace tenant appears as one Afi tenant per region, with the same external id.

Paging

Lists take limit and pageToken and answer next_page_token. Pass that value back as pageToken until it comes back empty: a short page does not mean the list is complete.

Tasks and polling

Protecting a resource answers the id of the backup job it starts, and running a job answers the id of the task it spawns. Read the task with afi_get_task, and wait longer between each read (15 seconds, then 30, 60, 2 minutes and 4 minutes): Afi says faster polling does not change the answer sooner and only spends the rate limit.

Changes that ask for approval

These tools are Pro and are marked destructive, so an agent asks for approval before it runs them:

  • Create an organization - when you give an administrator email, Afi emails that person an invitation to become the organization's administrator.
  • Protect a resource - Afi starts backing it up and licenses it.
  • Unprotect a resource - Afi stops backing it up under that policy.
  • Run a job - Afi runs the job now, outside its schedule. The job id can name any job of the tenant.
  • Delete an archive - Afi schedules the archive for deletion after 7 days, during which you can cancel it in Afi. A reason of up to 128 bytes is required.

When an organization is created, Afi answers an invitation link that lets someone become that organization's administrator. StackJack leaves the link out of the answer unless the agent asks for it with includeSecrets. The invitation email reaches the administrator either way.

Rate limit

Afi does not publish a rate limit. It asks callers not to poll, and says that an app that ignores its request to back off can be throttled harder or suspended. StackJack paces one connection at about one call a second and backs off when Afi answers that the limit is reached.

When Afi refuses a call

  • The key is refused (401): the key was deleted from the app, or the app was removed. Generate a new key and paste it again.
  • The app lacks a role (403): the app does not have the role the call needs, or it is not installed in that organization or tenant. Roles cannot be changed later: create a new app with the roles you need, install it, and paste its key.
  • Something is not found (404): check the id with the list tools. A resource can be read by its external id only with the ext$ prefix, and protect and unprotect accept only Afi ids.
  • A value is rejected (400): the answer names it, for example a time window longer than Afi allows.
  • Rate limited (429) or an outage (5xx): wait and try again.

Plans and limits

Every read is available on the Free tier. Every change is Pro. Business reaches the same tools as Pro and differs by monthly call quota.

See the generated AFI Backup tool reference for the current inventory, plan assignment, input schemas and destructive-action labels.

AFI Backup tools

afi_ · 22 tools · Free 17 · Pro 5

Organizations and tenants

ToolWhat it does
afi_create_organization
Pro · Destructive
DESTRUCTIVE.
afi_get_organization
Free · Read-only
Reads one organization (id, external_id, kind, name).
afi_get_tenant
Free · Read-only
Reads one tenant.
afi_get_tenant_quotas
Free · Read-only
Reads a tenant's usage and its quota limits.
afi_list_app_installations
Free · Read-only
Lists the organizations and tenants where the Afi app whose API key this connection holds is installed (each item is a tenant_id and an org_id).
afi_list_child_organizations
Free · Read-only
Lists the child organizations of an organization.
afi_list_tenants
Free · Read-only
Lists the tenants of an organization (id, external_id, kind such as a Microsoft 365 or Google Workspace tenant, name, region, deleted).

Licensing

ToolWhat it does
afi_get_subscription_history
Free · Read-only
Reads the historical usage of an organization's post-pay subscriptions over a window; a subscription whose licensed quantity changed appears once per quantity.
afi_list_subscriptions
Free · Read-only
Lists the licensing subscriptions of an organization; each tenant has its own subscription.

Resources and protections

ToolWhat it does
afi_get_resource
Free · Read-only
Reads one resource by its Afi id, or by the external system's id prefixed with ext$ (for example ext$ followed by a Microsoft 365 user id).
afi_get_resource_stats
Free · Read-only
Reads a tenant's protection statistics, grouped by resource kind: how many resources are protected and how many are not.
afi_list_policies
Free · Read-only
Lists the backup (SLA) policies available to a tenant; their ids are what afi_protect_resource and afi_unprotect_resource take.
afi_list_protections
Free · Read-only
Lists the protections (policy assignments) of a tenant's resources, or of one resource.
afi_list_resources
Free · Read-only
Lists the resources a tenant owns (mailboxes, drives, sites, shared drives and so on: id, external_id, name, kind, archived).
afi_protect_resource
Pro · Destructive
DESTRUCTIVE.
afi_unprotect_resource
Pro · Destructive
DESTRUCTIVE.

Tasks and audit

ToolWhat it does
afi_get_task
Free · Read-only
Reads one task (id, resource_id, status).
afi_get_task_stats
Free · Read-only
Counts a tenant's tasks by status over a period of at most 31 days that falls within the last 35 days.
afi_list_audit_events
Free · Read-only
Lists a tenant's audit events (who did what, when).
afi_trigger_job
Pro · Destructive
DESTRUCTIVE.

Archives

ToolWhat it does
afi_delete_archive
Pro · Destructive
DESTRUCTIVE.
afi_list_archives
Free · Read-only
Lists a tenant's archives, or one resource's.