# REST API

The REST API lets you automate management of your SparkLogs workspace the way an administrator does in the app.
It creates and organizes client organizations, creates the registration tokens that deploy agents, manages who can see which client, and reads the audit log.

You can use it to invite and remove users, to keep groups and their access current, and to record PSA and RMM ids on organizations.
For MSPs, a more advanced use is creating a client's organization before any agent is deployed.
Most MSPs do not need API automation for this and instead should just use their [RMM to deploy agents](https://sparklogs.com/docs/agents/deploy/rmm.md).

OpenAPI 3.1 specification: <https://sparklogs.com/api/openapi.json>

Some operations are not available in the API and can only be performed in the app:

- creating, renaming and revoking API tokens (through the API, a token can only rotate its own secret)
- approving, viewing and disconnecting connected AI apps
- accepting an invitation
- setting up replication of archived data

The API does not query logs or device history.
It does report each agent's presence and collection health, and counts of enrolled, active and inactive agents.
To query the data, use the app or the [MCP API](https://sparklogs.com/docs/mcp.md).
[AI assistants connect to the MCP API](https://sparklogs.com/docs/it-fleet-intelligence/connect.md), and your own code can call it too, with an [API token](https://sparklogs.com/docs/api/authentication.md).

## Who it is for

- **Automation engineers at MSPs** who automate onboarding, offboarding and access changes in PowerShell or Python.
- **Integrators** who build SparkLogs into a PSA, an RMM or a documentation tool.
- **AI agents** working for an engineer or an integrator. Every page here is also available as Markdown, and the whole API as an [OpenAPI 3.1 file](https://sparklogs.com/api/openapi.json).

## Example API call

Every call goes to one address, whatever region your workspace is in, and carries an API token in the `Authorization` header.

```bash
curl "https://engine.sparklogs.app/app-api/credential" \
  -H "Authorization: Bearer $SPARKLOGS_TOKEN"
```

This call needs no scope.
It returns what the token is: its kind, its id, the workspace it belongs to, that workspace's region and its scopes.
The [quickstart](https://sparklogs.com/docs/api/quickstart.md) goes from creating a token to listing your client organizations.

## Key concepts

| Read | To learn |
| - | - |
| [Concepts](https://sparklogs.com/docs/api/concepts.md) | A big-picture overview of the API, including the data model and the available actions. |
| [Authentication](https://sparklogs.com/docs/api/authentication.md) and [Scopes](https://sparklogs.com/docs/api/scopes.md) | The kinds of token, what a token can reach, and how to give one the least it needs. |
| [Paging and sync](https://sparklogs.com/docs/api/paging-and-sync.md) | How to page large results and do incremental fetches. |
| [Errors](https://sparklogs.com/docs/api/errors.md), [Rate limits](https://sparklogs.com/docs/api/rate-limits.md) and [Retries](https://sparklogs.com/docs/api/retries.md) | What a failed call returns and when it is safe to send again. |
| [Example use cases](https://sparklogs.com/docs/api/use-cases.md) | Call-by-call examples: onboarding a client, syncing with a PSA, preparing for an audit. |
| [Reference](https://sparklogs.com/docs/api/reference.md) | Every call, parameter and field. |

## API stability

Every API call is in Preview right now while we gather feedback.
We expect few breaking changes.
See [Versioning and Stability](https://sparklogs.com/docs/api/versioning.md).

---

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