> For the complete documentation index, see [llms.txt](https://docs.autentique.com.br/api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.autentique.com.br/api/queries/resgatando-documentos.md).

# Retrieving documents

{% hint style="warning" %}
Avoid using these methods to frequently check the status of signatures. Webhooks are a faster and more efficient way to do this (and our backend will thank you :sweat\_smile: )
{% endhint %}

### Retrieving a specific document

In [Altair](https://altair.autentique.com.br/), you can test with the "Retrieve document" item from the pre-built collection. Don't forget to complete the query with the ID of an existing document to search.

```graphql
# If you copy the query, remember to remove the comments

query {
  document(id: "DOCUMENT ID") {
    id
    name
    refusable
    sortable
    created_at
    files { original signed pades }
    signatures {
      public_id
      name
      email
      created_at
      action { name }
      link { short_link } # Signature link when the signer is added by "name" instead of "email"
      user { id name email phone }
      user_data { name email phone } # Data related to lock_user_data when creating the document
      email_events {
        sent # Email sending timestamp confirmation
        opened # Email open timestamp (may not be registered in some email clients)
        delivered # Email open timestamp (may not be registered in some email clients)
        refused # Email sending error timestamp
        reason # Error message returned when sending fails
      }
      viewed { ...event } # When the signer views
      signed { ...event } # When the signer signs
      rejected { ...event } # When the signer rejects
      signed_unapproved { ...event } # When the signer signs but is pending biometric approval
      biometric_approved { ...event } # When the pending biometric of the signer is approved
      biometric_rejected { ...event } # When the pending biometric of the signer is rejected
    }
  }
}

fragment event on Event {
  ip
  port
  reason
  created_at
  geolocation {
    country
    countryISO
    state
    stateISO
    city
    zipcode
    latitude
    longitude
  }
}
```

You may check the results straight in [Altair](https://altair.autentique.com.br):

<figure><img src="/files/RUW94EUZuTD6Djyygfzw" alt=""><figcaption></figcaption></figure>

Similarly, you can use fragments as a way to avoid repetition in queries with GraphQL.

You can also query multiple documents at once:

```graphql
query {
  first: document(id: "DOCUMENT_ID_1") { name }
  second: document(id: "DOCUMENT_ID_2") { name }
  third: document(id: "DOCUMENT_ID_3") { name }
}
```

<figure><img src="/files/OHDevfnsGofed8eKI9pU" alt=""><figcaption></figcaption></figure>

As shown in the image above, you can also name the queries. (Note: The name cannot contain only numbers).

### Listing Documents

It is also possible to return pages containing multiple documents:

```graphql
query {
  documents(limit: 60, page: 1) {
    total
    data {
      id
      name
      refusable
      sortable
      created_at
      signatures {
        public_id
        name
        email
        created_at
        action { name }
        link { short_link }
        user { id name email }
        viewed { created_at }
        signed { created_at }
        rejected { created_at }
      }
      files { original signed }
    }
  }
}
```

<figure><img src="/files/5HYdWM9CT7yECp2UxTnZ" alt=""><figcaption></figcaption></figure>

#### Retrieving documents from a folder

You can also retrieve the documents contained in a folder:

```graphql
query{
  documentsByFolder(folder_id: "FOLDER_ID", limit: 60, page: 1) {
    data {
      id
      name
      qualified
      sandbox
      created_at
      deleted_at
    }
    has_more_pages
  }
}
```

The *query* itself is practically the same as listing documents, with the only difference being that you can specify a folder ID to perform the search. The information returned is also of the same type as the previous request.

<figure><img src="/files/XYixLz27mBXNwETMmPms" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
You can check what each of these parameters means directly in the full GraphQL API documentation, in the Docs menu of [Altair](https://altair.autentique.com.br/). If you're not sure how to do that, check out our tutorial on [**Using Altair**](/api/integration-basics/altair.md).
{% endhint %}

{% hint style="info" %}
If Altair doesn't help you integrate with the API, check out some examples of how to make these requests in other ways: <https://graphql.org/graphql-js/graphql-clients/>
{% endhint %}

{% file src="/files/-M03o9cE5QB3vLoPUlzJ" %}
Para importar e usar no Postman
{% endfile %}
