# Example Use Cases

Each example use case is shown one API call at a time, with every request and response.
Each lists the token, role and scopes it needs, what to do when a step fails, and whether its calls are safe to repeat.

| Example | Use it when |
| - | - |
| [Sync organizations with a PSA](https://sparklogs.com/docs/api/use-cases/sync-organizations.md) | Client names, ids and structure in SparkLogs should match your PSA without anyone retyping them. |
| [Give a client IT administrator access](https://sparklogs.com/docs/api/use-cases/grant-client-admin-access.md) | A co-managed client's own IT administrator should manage only that client's organization. |
| [Give a technician access to some clients](https://sparklogs.com/docs/api/use-cases/grant-technician-access.md) | A technician joins a team and should see only that team's clients. |
| [Offboard a technician](https://sparklogs.com/docs/api/use-cases/offboard-technician.md) | A technician leaves, and their access, tokens and connected apps should be removed. |
| [Onboard a client](https://sparklogs.com/docs/api/use-cases/onboard-client.md) | A company is added in your PSA, and you want its organization and sites created before its devices register. |
| [Add a log source for a client](https://sparklogs.com/docs/api/use-cases/add-log-source.md) | A firewall, server or application should send logs for a client. |
| [Offboard a client](https://sparklogs.com/docs/api/use-cases/offboard-client.md) | A client leaves, and its agents, access and organizations should be removed. |
| [Pull agent collection health into a dashboard](https://sparklogs.com/docs/api/use-cases/agent-collection-health.md) | An agent that stops reporting or collecting should show on a dashboard or raise a ticket. |
| [Fetch latest agent installer](https://sparklogs.com/docs/api/use-cases/deploy-agents.md) | Your own tooling or your RMM script should look up the current agent installer, its hash and its install command. |
| [Rotate credentials on a schedule](https://sparklogs.com/docs/api/use-cases/rotate-credentials.md) | Your policy requires secrets to be replaced on a schedule. |
| [Prepare for an audit](https://sparklogs.com/docs/api/use-cases/access-review.md) | A client or auditor asks who can reach their data and what was done. |

## Two smaller examples

**Move a device to the right client.**
Find it with [list agents](https://sparklogs.com/docs/api/reference/agents.md#list-agents), filtered by the organization it is in now and by `reported_hostname`, then [move it](https://sparklogs.com/docs/api/reference/agents.md#move-agent) to the right organization.
The filter ignores case and returns every agent that reports that name, which can be more than one.
The token needs `fleet:write`.

**Retire a device your RMM reports as decommissioned.**
Find it with list agents as above, then [delete it](https://sparklogs.com/docs/api/reference/agents.md#delete-agent) with `uninstall=immediately`.

Every example uses one made-up MSP, Northwind IT Services, and its clients. An id on one page is the same object on every other page.

---

Source: <https://sparklogs.com/docs/api/use-cases>
All SparkLogs documentation in Markdown: <https://sparklogs.com/llms.txt>
