# Query saved authority accounts

Source: https://developer.avalara.com/products/returns/integration-guides/managed-returns/apn4585095333300/

Guide: Avalara Managed Returns API (U.S. and Canada)

# Query saved authority accounts

Retrieve saved authority usernames and portal URLs for in-flight onboarding jobs with the `savedAuthorityAccounts` GraphQL query.

The `savedAuthorityAccounts` query returns authority accounts saved for in-flight onboarding jobs. Use it to recover saved progress in a returning user session and resume onboarding without entering portal credentials again. Each entry includes the authority portal URL and the saved username.

This operation is optional. Use it with the `resumeAuthorityAccess` mutation to support session recovery.

**Key considerations**:

-   **Job ID correlation**: Pass the job IDs from the `jobId` field returned by earlier `grantAuthorityAccess` calls.

-   **Credential privacy**: The query returns only the portal URL and saved username. Stored passwords are never exposed or returned in API responses.

## View request

```
query SavedAuthorityAccounts($companyId: ID!, $jobIds: [ID!]!) {
  savedAuthorityAccounts(companyId: $companyId, jobIds: $jobIds) {
    jobId
    portalUrl
    username
  }
}
```

**Input variables**:

```
{
  "companyId": "1234567",
  "jobIds": ["100001"]
}
```

Table 1. Input variable details

Argument

Type

Description

`companyId`

`ID!`

The company that owns the jobs.

`jobIds`

`[ID!]!`

An array of job IDs to look up, obtained from the `jobId` field on `grantAuthorityAccess`.

## View response

```
{
  "data": {
    "savedAuthorityAccounts": [
      {
        "jobId": "100001",
        "portalUrl": "https://myalabamataxes.alabama.gov/_/",
        "username": "your-portal-username"
      }
    ]
  }
}
```

**Response field descriptions**:

Response field

Description

`jobId`

The job associated with the saved account.

`portalUrl`

The authority portal URL.

`username`

The saved username for the portal.

## Next step

To resume and retry onboarding jobs with stored credentials, see [Resume authority onboarding session](/managed-returns/gfx1144966310754/ "Resume in-flight onboarding jobs with saved credentials by using the resumeAuthorityAccess GraphQL mutation.").