> ## Documentation Index
> Fetch the complete documentation index at: https://docs.judit.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Consulta de Sistemas e Credenciais

> Liste os sistemas disponíveis no Cofre, com o `system_name` exato para usar no cadastro, e confira o status das credenciais de uma `customer_key`. Este endpoint não cadastra credenciais.

<ResponseExample>
  ```json Sem customer_key theme={null}
  {
  	"systems": [
  		{
  			"name": "*",
  			"customer_key": "",
  			"credential_status": "not exists"
  		},
  		{
  			"name": "EPROC - JFES - 1º grau",
  			"customer_key": "*",
  			"credential_status": "not exists"
  		},
  		{
  			"name": "PJE TJBA - 1º grau",
  			"customer_key": "*",
  			"credential_status": "active"
  		},
  		{
  			"name": "PJE TRF1 - 2º grau",
  			"customer_key": "*",
  			"credential_status": "not exists"
  		}
  	]
  }
  ```

  ```json Com customer_key=advogado_01 theme={null}
  {
  	"systems": [
  		{
  			"name": "*",
  			"customer_key": "advogado_01",
  			"credential_status": "active"
  		},
  		{
  			"name": "PJE TJBA - 1º grau",
  			"customer_key": "advogado_01",
  			"credential_status": "active"
  		}
  	]
  }
  ```
</ResponseExample>

<Accordion title="Tipos de Status das Credenciais">
  *credential\_status pode ser*:

  `not exists`: Não cadastrada

  `active`: Cadastrada e ativa

  `inactive`: A credencial falhou no login do tribunal (senha inválida ou expirada, usuário bloqueado ou certificado vencido). Revalide o login no portal do tribunal e cadastre a credencial novamente para voltar a `active`.

  Caso seja utilizado um cadastro no sistema \* (cadastro genérico), essa credencial será utilizada para todos os tribunais que não tenham outro cadastro na mesma `customer_key`, então cuidado com esse tipo de cadastro.
</Accordion>

Sem o parâmetro `customer_key` (ou com `?customer_key=*`), a resposta lista todos os sistemas disponíveis no Cofre, com o status de cada um na chave padrão `*` (use essa lista para copiar o `system_name` exato). O exemplo acima está resumido. Como ler o exemplo sem `customer_key`:

* **Linha `"name": "*"` com `"customer_key": ""`:** é a credencial coringa da chave padrão. O `customer_key` vem vazio porque não há coringa cadastrada nessa chave (`not exists`). Quando há, ele vem preenchido.
* **Demais linhas com `"customer_key": "*"`:** a API repete a chave padrão usada no filtro, mesmo quando o status é `not exists`. Esse `*` não é uma credencial coringa cadastrada.

Com `?customer_key=...`, a linha `"name": "*"` é a coringa dessa chave e as demais linhas são apenas os sistemas com credencial própria nela. Se nenhuma `customer_key` for informada no cadastro, é usado o valor padrão `*`; a chave padrão nunca é vazia.


## OpenAPI

````yaml openapi/vault.json GET /credentials
openapi: 3.0.3
info:
  title: JUDIT - Credentials Vault API
  description: >-
    OpenAPI description for the credentials vault routes: register, inspect and
    delete per-tribunal credentials (username/password, 2FA secret or A1
    certificate).
  version: 1.0.0
servers:
  - url: https://crawler.prod.judit.io
    description: Production server
security:
  - ApiKeyAuth: []
tags:
  - name: Credentials
    description: Register and inspect tribunal system credentials stored in the vault
paths:
  /credentials:
    get:
      tags:
        - Credentials
      summary: List credential status by system
      description: >-
        Returns the credential status of each tribunal system. Without
        `customer_key`, lists every system available in the vault (use it to
        copy the exact `system_name`). With `customer_key`, lists only the
        systems that have a credential for that key, plus the wildcard (`*`)
        row. `inactive` means the credential failed to log in to the court
        (invalid/expired password, blocked user or expired certificate);
        re-register it to make it `active` again.
      operationId: getCredentials
      parameters:
        - name: customer_key
          in: query
          required: false
          description: Credential key defined at registration. Defaults to `*`.
          schema:
            type: string
      responses:
        '200':
          description: List of systems with their credential status
          content:
            application/json:
              schema:
                type: object
                properties:
                  systems:
                    type: array
                    items:
                      type: object
                      properties:
                        name:
                          type: string
                          description: >-
                            Tribunal system name, or `*` for the wildcard
                            credential
                        customer_key:
                          type: string
                          description: >-
                            Key used as the filter (default `*`). In the `*` row
                            it is empty when no wildcard credential exists for
                            that key; the other rows repeat the filter key even
                            when the status is `not exists`.
                        credential_status:
                          type: string
                          enum:
                            - not exists
                            - active
                            - inactive
                          description: >-
                            `active`: available. `inactive`: failed to log in to
                            the court. `not exists`: no credential registered.
              example:
                systems:
                  - name: '*'
                    customer_key: ''
                    credential_status: not exists
                  - name: PJE TJBA - 1º grau
                    customer_key: '*'
                    credential_status: not exists
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: api-key
      description: API key for authentication

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.