--- title: "Service Accounts" slug: "service-accounts" updated: 2026-11-17T16:50:06Z published: 2026-11-17T16:50:06Z canonical: "docs.crossworkassurance.cisco.com/service-accounts" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.crossworkassurance.cisco.com/llms.txt > Use this file to discover all available pages before exploring further. # Service Accounts Service accounts are **non-human, programmatic identities** that allow scripts, devices, and external integrations to authenticate to Crosswork Assurance without using a human user's credentials. Each service account is a machine user scoped to your tenant organization. ## Deployment Availability The following table shows which API authentication methods are available per deployment type. | Authentication Method | Cloud (SaaS) | On-Premises / Air-Gapped | | --- | --- | --- | | Username + password | ✓ | ✗ Not supported | | OAuth 2.0 with PKCE | See [Intro to REST APIs](https://docs.accedian.io/v1/docs/intro-to-rest-apis) | ✓ See [Configure OAuth 2.0 Clients](/v1/docs/configuring-oauth-20-clients-for-api-access) | | Service account (PAT) | Not available | ✓ Controlled Availability | ## Overview Use service accounts when you need to: - **Stream data exports** — External gNMI clients or Kafka consumers authenticating to Analytics Streamer - **Automate API access** — Scripts, CI/CD pipelines, or external tools that need programmatic access - **Integrate third-party systems** — SIEMs, BI tools, or data lakes consuming Crosswork Assurance telemetry Each service account can have one or more **Personal Access Tokens (PATs)** that serve as bearer tokens for authentication. > **Best Practice:** Create one service account per external integration so that credentials can be issued, scoped, audited, and revoked independently. ## Prerequisites - You must have the `skylight-admin` or `tenant-admin` role - Roles granted to a service account cannot exceed your own roles > **Note:** There are no enforced limits on the number of service accounts or PATs per tenant. ## Create a Service Account ### Using the UI 1. Navigate to **Accounts** > **Service users** tab. ![](https://cdn.document360.io/01d1de5e-a375-4fbc-aa82-666ac04c2113/Images/Documentation/image-ML45NQ49.png?sv=2026-02-06&spr=https&st=2026-11-30T23%3A49%3A43Z&se=2026-12-01T00%3A49%3A43Z&sr=b&sp=r&sig=QSE5h4eW%2BeKtIW%2BmuzEwaOsUvYtLT0KGJexzpd90tcM%3D) 2. Click the **+** button to create a new service user. 3. Complete the form: - **Name** — Human-readable display name - **Username** — Unique identifier for the service account - **Description** — (Optional) Purpose of the service account - **Access token type** — Select `Bearer` - **Analytics role** — Select the appropriate role: `skylight-admin`, `tenant-admin`, or `service-account-manager` 4. (Optional) To create a PAT at the same time: ![](https://cdn.document360.io/01d1de5e-a375-4fbc-aa82-666ac04c2113/Images/Documentation/image-ECKGYTO2.png?sv=2026-02-06&spr=https&st=2026-11-30T23%3A49%3A43Z&se=2026-12-01T00%3A49%3A43Z&sr=b&sp=r&sig=Lz7yszQrYTZhX1PpOaFUbg%2FfbJDPv7tTuC%2BZydPzfjM%3D) - Check **Create with PAT** - Set an **Expiration date** (must be in the future) 5. Click the **checkmark** button to create. 6. **Important:** If you created a PAT, click **Copy to clipboard** immediately. The PAT value is only displayed once and cannot be retrieved later. ![](https://cdn.document360.io/01d1de5e-a375-4fbc-aa82-666ac04c2113/Images/Documentation/image-MUOPKPJU.png?sv=2026-02-06&spr=https&st=2026-11-30T23%3A49%3A43Z&se=2026-12-01T00%3A49%3A43Z&sr=b&sp=r&sig=CmInR0uAKBrZugzcpgJK8IknmhZExASC%2B6E3mJJy5qk%3D) ### Using the API ``` curl --request POST \ --url '{baseUrl}/api/v2/auth/serviceaccount?withPAT=true&roles=tenant-admin' \ --header 'Authorization: Bearer {yourToken}' \ --header 'Content-Type: application/json' \ --header 'X-Forwarded-Tenant-Id: {tenantId}' \ --data '{ "username": "streamer-export", "name": "Streamer Export", "accessTokenType": "Bearer", "description": "Used by analytics streamer for gNMI export", "expirationDate": "2026-12-31T23:59:59Z" }' ``` **Request body fields:** | Field | Required | Description | | --- | --- | --- | | `username` | Yes | Unique identifier within your tenant | | `name` | Yes | Human-readable display name | | `accessTokenType` | Yes | Set to `Bearer` for PAT authentication | | `description` | No | Free text description (max 400 characters) | | `expirationDate` | Only with `withPAT=true` | RFC 3339 timestamp for PAT expiry | **Query parameters:** | Parameter | Description | | --- | --- | | `withPAT` | Set to `true` to create a PAT with the service account | | `roles` | Comma-separated roles to assign: `skylight-admin`, `tenant-admin`, or `service-account-manager` (default: `tenant-admin`) | **Example response:** ``` { "machineUserId": "291606795498498048", "username": "streamer-export", "name": "Streamer Export", "description": "Used by analytics streamer for gNMI export", "pat": "ZXlKaGJHY2lPaUpTVXpJMU5pSXNJblI1Y0NJNklr..." } ``` > **Important:** The `pat` field is only returned when `withPAT=true`. This is your only opportunity to capture the token value — it cannot be retrieved later. ## Manage Personal Access Tokens (PATs) A PAT is an opaque bearer token that you include in the `Authorization` header of API requests: ``` Authorization: Bearer ``` ### Add a PAT to an Existing Service Account #### Using the UI 1. Navigate to **Accounts** > **Service users** tab. 2. Select the service account from the list. 3. Under **Personal tokens**, click **Add**. ![](https://cdn.document360.io/01d1de5e-a375-4fbc-aa82-666ac04c2113/Images/Documentation/image-VSZU1EK7.png?sv=2026-02-06&spr=https&st=2026-11-30T23%3A49%3A43Z&se=2026-12-01T00%3A49%3A43Z&sr=b&sp=r&sig=3feL2DmgkySoQY3S%2Fo7ucra0GDHflbHXJl13a9JwJUk%3D) 4. Set an **Expiration date** (must be in the future). ![](https://cdn.document360.io/01d1de5e-a375-4fbc-aa82-666ac04c2113/Images/Documentation/image-SLLP1RS1.png?sv=2026-02-06&spr=https&st=2026-11-30T23%3A49%3A43Z&se=2026-12-01T00%3A49%3A43Z&sr=b&sp=r&sig=KOAagoYLOIKqIo7BNMLI6rrGzM1Thj%2Fpuok%2FH2eDklk%3D) 5. Click **Create**. 6. Click **Copy to clipboard** to capture the PAT value before leaving the screen. ![](https://cdn.document360.io/01d1de5e-a375-4fbc-aa82-666ac04c2113/Images/Documentation/image-EZ6MP2HB.png?sv=2026-02-06&spr=https&st=2026-11-30T23%3A49%3A43Z&se=2026-12-01T00%3A49%3A43Z&sr=b&sp=r&sig=GxlTsjGuawaBHbXTTTlkZ32mWYGLRp8uxEHHMYHoABA%3D) #### Using the API ``` curl --request POST \ --url '{baseUrl}/api/v2/auth/serviceaccount/{machineUserId}/pat' \ --header 'Authorization: Bearer {yourToken}' \ --header 'Content-Type: application/json' \ --header 'X-Forwarded-Tenant-Id: {tenantId}' \ --data '{ "expirationDate": "2026-12-31T23:59:59Z" }' ``` **Example response:** ``` { "credentialId": "291606795498498200", "machineUserId": "291606795498498048", "expirationDate": "2026-12-31T23:59:59Z", "pat": "ZXlKaGJHY2lPaUpTVXpJMU5pSXNJblI1Y0NJNmlr..." } ``` ### List PATs ``` curl --request POST \ --url '{baseUrl}/api/v2/auth/serviceaccount/{machineUserId}/pat/search?page=1&pageSize=25' \ --header 'Authorization: Bearer {yourToken}' \ --header 'Content-Type: application/vnd.api+json' \ --header 'X-Forwarded-Tenant-Id: {tenantId}' ``` > **Note:** The search endpoint returns metadata only (creation date, expiration date, credential ID) — never the token value. ### Delete a PAT Deleting a PAT revokes it immediately. Any integrations using that PAT will lose access. #### Using the UI 1. Navigate to the service account's detail page. 2. Under **Personal tokens**, click the **trash icon** next to the PAT you want to delete. ![](https://cdn.document360.io/01d1de5e-a375-4fbc-aa82-666ac04c2113/Images/Documentation/image-PVENE559.png?sv=2026-02-06&spr=https&st=2026-11-30T23%3A49%3A43Z&se=2026-12-01T00%3A49%3A43Z&sr=b&sp=r&sig=qBeCPDwxcoY5jEGPLD2GSzagGnkxRA6MRC49EC3fMWU%3D) 3. The PAT is deleted and a confirmation message appears. ![](https://cdn.document360.io/01d1de5e-a375-4fbc-aa82-666ac04c2113/Images/Documentation/image-EMZ9X7HL.png?sv=2026-02-06&spr=https&st=2026-11-30T23%3A49%3A43Z&se=2026-12-01T00%3A49%3A43Z&sr=b&sp=r&sig=V5yUevu2s2OZXETvbN17ly1UcugjtDTosC08b54PFu0%3D) #### Using the API ``` curl --request DELETE \ --url '{baseUrl}/api/v2/auth/serviceaccount/{machineUserId}/pat/{credentialId}' \ --header 'Authorization: Bearer {yourToken}' \ --header 'X-Forwarded-Tenant-Id: {tenantId}' ``` ## Manage Service Accounts ### Search Service Accounts ``` curl --request POST \ --url '{baseUrl}/api/v2/auth/serviceaccount/search?page=1&pageSize=25' \ --header 'Authorization: Bearer {yourToken}' \ --header 'Content-Type: application/vnd.api+json' \ --header 'X-Forwarded-Tenant-Id: {tenantId}' \ --data '{ "data": { "attributes": { "username": { "value": "streamer-export" } } } }' ``` ### Get a Service Account ``` curl --request GET \ --url '{baseUrl}/api/v2/auth/serviceaccount/{machineUserId}' \ --header 'Authorization: Bearer {yourToken}' \ --header 'X-Forwarded-Tenant-Id: {tenantId}' ``` ### Update a Service Account Update the name or description of an existing service account: ``` curl --request PATCH \ --url '{baseUrl}/api/v2/auth/serviceaccount/{machineUserId}' \ --header 'Authorization: Bearer {yourToken}' \ --header 'Content-Type: application/json' \ --header 'X-Forwarded-Tenant-Id: {tenantId}' \ --data '{ "name": "Streamer Export (Production)", "description": "Updated description" }' ``` ### Delete a Service Account Deleting a service account removes the machine user and **revokes all of its PATs**. Any integrations using those PATs will lose access. ``` curl --request DELETE \ --url '{baseUrl}/api/v2/auth/serviceaccount/{machineUserId}' \ --header 'Authorization: Bearer {yourToken}' \ --header 'X-Forwarded-Tenant-Id: {tenantId}' ``` ## Use a PAT for Authentication Once you have a PAT, include it in the `Authorization` header of your API requests: ``` curl --request GET \ --url '{baseUrl}/api/v2/some-endpoint' \ --header 'Authorization: Bearer {pat}' \ --header 'X-Forwarded-Tenant-Id: {tenantId}' ``` ### Example: gNMI Streaming Client ``` gnmicli --addr tenant1.analytics.example.com:443 \ --query /accedian:session/object-type/twamp-sf/monitored-objects/... \ --auth token \ --authToken 'Bearer ' ``` ## API Response Codes | Code | Meaning | | --- | --- | | `201` | Service account or PAT created successfully | | `200` | Request successful | | `400` | Invalid request body or path parameter | | `403` | Caller lacks the required role, or requested roles exceed the caller's | | `404` | Service account or PAT not found | | `409` | A service account with this username already exists | | `422` | Validation failed (for example, username conflicts with a human user) | ## Troubleshooting ### Common Errors #### 401 Unauthorized **Symptom:** API requests fail with `401 Unauthorized`. **Causes:** - PAT is missing or malformed in the `Authorization` header - PAT has been deleted or revoked - Incorrect header format (must be `Bearer <PAT>`, not just `<PAT>`) **Resolution:** 1. Verify the PAT is included: `Authorization: Bearer <your-pat>` 2. Check if the PAT still exists in the service account's token list 3. If the PAT was deleted, create a new one and update your integration #### 403 Forbidden **Symptom:** API requests fail with `403 Forbidden`. **Causes:** - PAT has expired - Service account lacks the required role for the requested operation - `X-Forwarded-Tenant-Id` header is missing or incorrect **Resolution:** 1. Check the PAT expiration date in the service account details 2. Verify the service account has the necessary roles assigned 3. Confirm the tenant ID matches your organization #### 409 Conflict **Symptom:** Creating a service account fails with `409 Conflict`. **Cause:** A service account with the same username already exists. **Resolution:** Choose a unique username, or search for the existing account and reuse it. #### 422 Unprocessable Entity **Symptom:** Creating a service account fails with `422 Unprocessable Entity`. **Cause:** The username conflicts with an existing human user account. **Resolution:** Choose a different username that doesn't match any human user in your tenant. ### PAT Rotation Without Downtime To rotate a PAT without interrupting your integration: 1. **Create a new PAT** on the existing service account (you can have multiple active PATs) 2. **Update your integration** with the new PAT 3. **Verify** the integration works with the new PAT 4. **Delete the old PAT** once the new one is confirmed working > **Tip:** Schedule PAT rotation before expiration. Set a calendar reminder for 30 days before each PAT expires. ### Security Best Practices - **Never commit PATs to source control** — Use environment variables or a secrets manager - **Store PATs securely** — Use HashiCorp Vault, AWS Secrets Manager, Azure Key Vault, or similar - **Set appropriate expiration dates** — Balance security (shorter) with operational overhead (longer) - **One service account per integration** — Enables independent credential management and audit trails - **Monitor for failed authentications** — Repeated 401/403 errors may indicate credential issues or misuse ## Related Topics ### Authentication & Access - [Authentication Prerequisites](/docs/prerequisites-for-authentication) — mTLS and PAT requirements for RESTCONF/gNMI - [Identity & Access Management API](https://api.crossworkassurance.cisco.com/iam-current.html) — Full API reference ### Integration Use Cases - [Accessing Crosswork Assurance with gNMI](/docs/accessing-provider-connective-assurance-with-gnmi) — Stream telemetry data using PAT authentication - [Working with the Agents Control API](/docs/agents-control-api) — Programmatic agent management ### User & Device Management - [Device Service Account Provisioning on Sensor Management](/docs/device-service-account-provisioning-on-sensor-management) — Automated device credential provisioning - [Managing User Accounts](/docs/managing-user-accounts-2) — User roles and permissions > **API Documentation Disclaimer** The APIs described in this document are for illustrative purposes. While efforts are made to keep this document current, always refer to the [IAM API documentation](https://api.crossworkassurance.cisco.com/iam-current.html) for the authoritative source. Replace example values with those applicable to your environment. **© 2026 Cisco and/or its affiliates. All rights reserved.** For more information about trademarks, please visit: [Cisco trademarks](https://www.cisco.com/c/en/us/about/legal/trademarks.html)[](https://www.cisco.com/c/en/us/about/legal/trademarks.html) For more information about legal terms, please visit: [Cisco legal terms](https://www.cisco.com/c/en/us/about/legal/terms-conditions.html)