# 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="https://1605753490-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIbBzLrA6555E5Ze2GMYf%2Fuploads%2FXi5xNcdTXFSMk9cO42JR%2FCleanShot%202025-10-29%20at%2013.54.20%402x.png?alt=media&#x26;token=54ed7e42-630b-404d-a6f0-762ce12317c6" 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="https://1605753490-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIbBzLrA6555E5Ze2GMYf%2Fuploads%2Fg7EHJgY0nP0BM6At3ZZb%2FCleanShot%202025-10-29%20at%2014.21.45%402x.png?alt=media&#x26;token=963c5355-13fa-41c5-bf4f-96171adae3ec" 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="https://1605753490-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIbBzLrA6555E5Ze2GMYf%2Fuploads%2FkQQB85RL5jaFiqAr4YJV%2FCleanShot%202025-10-29%20at%2014.24.21%402x.png?alt=media&#x26;token=128ba657-2101-45b9-8c1a-ca242c008f93" 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="https://1605753490-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIbBzLrA6555E5Ze2GMYf%2Fuploads%2F8mAVG9dtZeAT3ZsheVf6%2FCleanShot%202025-10-29%20at%2014.27.37%402x.png?alt=media&#x26;token=4dc6f177-8582-4ad7-b082-f0f9183d62c0" 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**](https://docs.autentique.com.br/api/integration-basics/altair).
{% 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="<https://content.gitbook.com/content/IbBzLrA6555E5Ze2GMYf/blobs/UYhF3Z8hbSdJj5dx0FvZ/Autentique%20v2.postman_collection.json>" %}
Para importar e usar no Postman
{% endfile %}
