> ## 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.

# Credential Registration

> To register a credential or update an existing one, use the route below.

<ParamField body="credentials" type="array" required={false}>
  <Expandable title="properties">
    <ParamField body="credential" type="object" required>
      <ParamField body="system_name" type="string" required>
        PJE TJBA - 1º grau or \* (wildcard)
      </ParamField>

      <ParamField body="customer_key" type="string" required>
        00000001 (use your own way of identifying a client)
      </ParamField>

      <ParamField body="username" type="string" required>
        999.999.999-99 (CPF)
      </ParamField>

      <ParamField body="password" type="string" required>
        Senha123
      </ParamField>
    </ParamField>
  </Expandable>
</ParamField>

<Accordion title="Important notes about credential registration">
  `Wildcard Credential`:  \*

  If you register a credential under it, every court that does not have its own specific credential will use the wildcard credential.

  If no `customer_key` is provided, an `empty` customer\_key will be created.
</Accordion>

If you want to remove the credential from a given system, you must send `username` and `password` as empty.

<ResponseExample>
  ```json theme={null}
  [
  	{
  		"system_name": "PJEINTER TJBA - 1º grau",
  		"customer_key": "00000001",
  		"message": "CREDENTIAL_CREATED"
  	},
  	{
  		"system_name": "PJE TJMT - 1º grau",
  		"customer_key": "00000001",
  		"message": "CREDENTIAL_CREATED"
  	},
  	{
  		"system_name": "PJE TJBA - 2º grau",
  		"customer_key": "00000001",
  		"message": "CREDENTIAL_CREATED"
  	},
  	{
  		"system_name": "PJEINTER TJMT - 1º grau",
  		"customer_key": "00000001",
  		"message": "CREDENTIAL_CREATED"
  	},
  	{
  		"system_name": "PROJUDI TJBA - 1º grau",
  		"customer_key": "00000001",
  		"message": "CREDENTIAL_CREATED"
  	},
  	{
  		"system_name": "PJE TJBA - 1º grau",
  		"customer_key": "00000001",
  		"message": "CREDENTIAL_CREATED"
  	},
  	{
  		"system_name": "PJE TJMT - 2º grau",
  		"customer_key": "00000001",
  		"message": "CREDENTIAL_CREATED"
  	},
  	{
  		"system_name": "PROJUDI TJBA - 2º grau",
  		"customer_key": "00000001",
  		"message": "CREDENTIAL_CREATED"
  	}
  ]
  ```
</ResponseExample>

**If the credential already exists, the message will be `CREDENTIAL_UPDATED`.**


## OpenAPI

````yaml openapi/vault.json POST /credentials
openapi: 3.0.3
info:
  title: JUDIT - Credentials Vault API
  description: >-
    OpenAPI description for the credentials vault routes, used to register and
    inspect per-tribunal system credentials. Mirrored locally so this page's
    playground exposes exactly one base URL (no other Judit service host).
    Transcribed from the fields already documented on the vault/vault and
    vault/vaultcreate pages.
  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:
    post:
      tags:
        - Credentials
      summary: Register or update credentials
      description: >-
        Registers a credential for a tribunal system, or updates it if it
        already exists. Send empty `username`/`password` to remove a credential
        for a given system.
      operationId: postCredentials
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                credentials:
                  type: array
                  items:
                    type: object
                    properties:
                      credential:
                        type: object
                        required:
                          - system_name
                          - customer_key
                          - username
                          - password
                        properties:
                          system_name:
                            type: string
                            description: e.g. "PJE TJBA - 1º grau" or `*` (wildcard)
                          customer_key:
                            type: string
                            description: Client-defined identifier for the credential owner
                          username:
                            type: string
                            description: e.g. CPF
                          password:
                            type: string
            example:
              credentials:
                - credential:
                    system_name: PJE TJBA - 1º grau
                    customer_key: '00000001'
                    username: 999.999.999-99
                    password: Senha123
      responses:
        '200':
          description: Credential(s) created or updated
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    system_name:
                      type: string
                    customer_key:
                      type: string
                    message:
                      type: string
                      enum:
                        - CREDENTIAL_CREATED
                        - CREDENTIAL_UPDATED
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: api-key
      description: API key for authentication

````