Pular para o conteúdo principal
POST
/
v1
/
schedules
Criar um agendamento Pix
curl --request POST \
  --url https://plugin-pix-indirect.api.lerian.net/v1/schedules \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'X-Account-Id: <x-account-id>' \
  --header 'X-Idempotency: <x-idempotency>' \
  --data '
{
  "amount": "100.50",
  "initiationId": "550e8400-e29b-41d4-a716-446655440010",
  "scheduledFor": "2026-08-15T00:00:00Z",
  "description": "Recurring charge installment 03/12",
  "endToEndId": "E1234567820260815060012345678901",
  "maxAttempts": 2,
  "recurrenceId": "01988a7c-1234-7abc-8def-111122223333"
}
'
import requests

url = "https://plugin-pix-indirect.api.lerian.net/v1/schedules"

payload = {
"amount": "100.50",
"initiationId": "550e8400-e29b-41d4-a716-446655440010",
"scheduledFor": "2026-08-15T00:00:00Z",
"description": "Recurring charge installment 03/12",
"endToEndId": "E1234567820260815060012345678901",
"maxAttempts": 2,
"recurrenceId": "01988a7c-1234-7abc-8def-111122223333"
}
headers = {
"X-Account-Id": "<x-account-id>",
"X-Idempotency": "<x-idempotency>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {
'X-Account-Id': '<x-account-id>',
'X-Idempotency': '<x-idempotency>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
amount: '100.50',
initiationId: '550e8400-e29b-41d4-a716-446655440010',
scheduledFor: '2026-08-15T00:00:00Z',
description: 'Recurring charge installment 03/12',
endToEndId: 'E1234567820260815060012345678901',
maxAttempts: 2,
recurrenceId: '01988a7c-1234-7abc-8def-111122223333'
})
};

fetch('https://plugin-pix-indirect.api.lerian.net/v1/schedules', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://plugin-pix-indirect.api.lerian.net/v1/schedules",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => '100.50',
'initiationId' => '550e8400-e29b-41d4-a716-446655440010',
'scheduledFor' => '2026-08-15T00:00:00Z',
'description' => 'Recurring charge installment 03/12',
'endToEndId' => 'E1234567820260815060012345678901',
'maxAttempts' => 2,
'recurrenceId' => '01988a7c-1234-7abc-8def-111122223333'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-Account-Id: <x-account-id>",
"X-Idempotency: <x-idempotency>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://plugin-pix-indirect.api.lerian.net/v1/schedules"

payload := strings.NewReader("{\n \"amount\": \"100.50\",\n \"initiationId\": \"550e8400-e29b-41d4-a716-446655440010\",\n \"scheduledFor\": \"2026-08-15T00:00:00Z\",\n \"description\": \"Recurring charge installment 03/12\",\n \"endToEndId\": \"E1234567820260815060012345678901\",\n \"maxAttempts\": 2,\n \"recurrenceId\": \"01988a7c-1234-7abc-8def-111122223333\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("X-Account-Id", "<x-account-id>")
req.Header.Add("X-Idempotency", "<x-idempotency>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://plugin-pix-indirect.api.lerian.net/v1/schedules")
.header("X-Account-Id", "<x-account-id>")
.header("X-Idempotency", "<x-idempotency>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"100.50\",\n \"initiationId\": \"550e8400-e29b-41d4-a716-446655440010\",\n \"scheduledFor\": \"2026-08-15T00:00:00Z\",\n \"description\": \"Recurring charge installment 03/12\",\n \"endToEndId\": \"E1234567820260815060012345678901\",\n \"maxAttempts\": 2,\n \"recurrenceId\": \"01988a7c-1234-7abc-8def-111122223333\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://plugin-pix-indirect.api.lerian.net/v1/schedules")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-Account-Id"] = '<x-account-id>'
request["X-Idempotency"] = '<x-idempotency>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"100.50\",\n \"initiationId\": \"550e8400-e29b-41d4-a716-446655440010\",\n \"scheduledFor\": \"2026-08-15T00:00:00Z\",\n \"description\": \"Recurring charge installment 03/12\",\n \"endToEndId\": \"E1234567820260815060012345678901\",\n \"maxAttempts\": 2,\n \"recurrenceId\": \"01988a7c-1234-7abc-8def-111122223333\"\n}"

response = http.request(request)
puts response.read_body
{
  "accountId": "019cf6ef-e418-7ced-80c0-7b9816faa798",
  "amount": "100.50",
  "attemptCount": 0,
  "attempts": [
    {
      "attemptedAt": "2026-08-15T06:00:02Z",
      "endToEndId": "E1234567820260815060011111111111",
      "failureMessage": "Midaz error: balance below required (06:00 BRT attempt)",
      "failureReason": "INSUFFICIENT_FUNDS",
      "initiationId": "a1111111-1111-4111-8111-111111111111",
      "transferId": "f1a2b3c4-1111-4d5e-9f6a-7b8c9d0e1f23"
    }
  ],
  "cancelledAt": "2026-05-19T09:15:33Z",
  "createdAt": "2026-05-26T12:30:00Z",
  "description": "Recurring charge installment 03/12",
  "destination": {
    "account": {
      "branch": "0001",
      "number": "123456789",
      "participant": "12345678",
      "type": "CACC"
    },
    "key": "john.doe@example.com",
    "owner": {
      "document": "12345678901",
      "name": "John Doe",
      "tradeName": "John's Business"
    }
  },
  "endToEndId": "E1234567820260815060012345678901",
  "executedAt": "2026-08-15T06:00:04Z",
  "failedAt": "2026-08-15T06:00:04Z",
  "failureMessage": "<string>",
  "failureReason": "INSUFFICIENT_FUNDS",
  "firedAt": "2026-08-15T06:00:04Z",
  "id": "01989f9e-6508-79f8-9540-835be49fbd0d",
  "initiationId": "550e8400-e29b-41d4-a716-446655440010",
  "initiationType": "MANUAL",
  "maxAttempts": 2,
  "recurrenceId": "01988a7c-1234-7abc-8def-111122223333",
  "scheduledFor": "2026-08-15T09:00:00Z",
  "status": "SCHEDULED",
  "transferId": "c8d27e3f-4a5b-6c7d-8e9f-0a1b2c3d4e5f",
  "updatedAt": "2026-05-26T12:30:00Z"
}
{
"code": "<string>",
"title": "<string>",
"message": "<string>"
}
{
"code": "<string>",
"title": "<string>",
"message": "<string>"
}
{
"code": "<string>",
"title": "<string>",
"message": "<string>"
}
{
"code": "<string>",
"title": "<string>",
"message": "<string>"
}
{
"code": "<string>",
"title": "<string>",
"message": "<string>"
}
{
"code": "<string>",
"title": "<string>",
"message": "<string>"
}

Autorizações

Authorization
string
header
obrigatório

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Cabeçalhos

X-Account-Id
string
obrigatório

Identificador único da Conta do Ledger Midaz (formato UUID).

X-Idempotency
string
obrigatório

Chave de idempotência (UUID v4 recomendado); repetições retornam a resposta 201 em cache.

Corpo

application/json
amount
string
obrigatório

Amount é o valor da transferência em BRL com 2 casas decimais (por exemplo, "100.50"). O formato e os limites são validados quando o agendamento dispara.

Exemplo:

"100.50"

initiationId
string
obrigatório

InitiationID ancora o agendamento a uma payment initiation existente que já carrega o snapshot de destino validado pelo DICT. O agendamento copia os campos de destino dessa initiation e armazena a referência como âncora de auditoria (nunca reutilizada no momento do disparo). Uma initiation deve existir antes de criar o agendamento.

Exemplo:

"550e8400-e29b-41d4-a716-446655440010"

scheduledFor
string<date-time>
obrigatório

ScheduledFor é a data de disparo em horário de relógio no formato ISO 8601 com fuso horário. O momento real de execução é resolvido a partir deste valor mais a hora de execução padrão do serviço (BRT). Chamadores recorrentes devem defini-lo como >= D-1 da data de vencimento.

Exemplo:

"2026-08-15T00:00:00Z"

description
string

Description é a mensagem legível opcional da transferência: opcional, no máximo 140 caracteres; conteúdo HTML ou script é rejeitado. Opcional no nível Pix / BACEN (informacoesEntreUsuarios).

Maximum string length: 140
Exemplo:

"Recurring charge installment 03/12"

endToEndId
string

EndToEndID é o identificador end-to-end do BACEN, opcional e gerado por quem faz a chamada, para o Pix agendado. Não está vinculado a header e não é obrigatório, então chamadores HTTP genéricos o omitem. Chamadores recorrentes (Pix Automático) que geram o id end-to-end do cashout de antemão o informam para que o disparo agendado reutilize o mesmo identificador. Seu formato é validado quando o pagamento é processado.

Exemplo:

"E1234567820260815060012345678901"

maxAttempts
integer

MaxAttempts limita o número de tentativas de disparo permitidas para este agendamento. O pagador do Pix Automático usa 2 (primeira tentativa às 06:00 BRT, retentativa por INSUFFICIENT_FUNDS às 18:00 BRT). Zero ou omitido usa o padrão do serviço.

Intervalo obrigatório: 1 <= x <= 2
Exemplo:

2

recurrenceId
string

RecurrenceID é uma âncora de correlação genérica que agrupa vários agendamentos criados pelo mesmo fluxo de origem (pagamento recorrente, assinatura, plano de parcelamento, ciclo de cobrança, etc.). Opcional. A camada de agendamento NÃO interpreta este valor — é um metadado opaco devolvido em GET / LIST e nos webhooks de saída schedule.* para que o consumidor de origem possa reagrupar. Nil para agendamentos avulsos e únicos que não têm grupo pai.

Exemplo:

"01988a7c-1234-7abc-8def-111122223333"

Resposta

Created

accountId
string

AccountID ecoa o AccountID de entrada para correlação de auditoria/log.

Exemplo:

"019cf6ef-e418-7ced-80c0-7b9816faa798"

amount
string

Amount é o valor em BRL com 2 casas decimais.

Exemplo:

"100.50"

attemptCount
integer

AttemptCount é o número de tentativas de disparo feitas até agora.

Exemplo:

0

attempts
object[]

Attempts é a lista cronológica de tentativas de disparo anteriores que falharam. A tentativa bem-sucedida não é incluída aqui; ela é registrada no próprio agendamento via TransferID e EndToEndID. Array vazio quando nenhuma falha foi registrada.

cancelledAt
string<date-time>

CancelledAt é o momento em que o agendamento chegou a CANCELLED. Ausente para registros que não estão em CANCELLED.

Exemplo:

"2026-05-19T09:15:33Z"

createdAt
string<date-time>

CreatedAt é a data/hora de persistência (ISO 8601 UTC).

Exemplo:

"2026-05-26T12:30:00Z"

description
string

Description é a mensagem legível opcional da transferência.

Exemplo:

"Recurring charge installment 03/12"

destination
object

Destination é o snapshot do destino capturado no agendamento.

endToEndId
string

EndToEndID é o identificador end-to-end do BACEN da transferência liquidada (resolvido via TransferID). Ausente para estados que não são EXECUTED.

Exemplo:

"E1234567820260815060012345678901"

executedAt
string<date-time>

ExecutedAt é o momento em que o agendamento chegou a EXECUTED. Ausente para registros que não estão em EXECUTED.

Exemplo:

"2026-08-15T06:00:04Z"

failedAt
string<date-time>

FailedAt é o momento em que o agendamento chegou ao estado terminal FAILED. Ausente para registros que não estão em FAILED. Simétrico a ExecutedAt / CancelledAt.

Exemplo:

"2026-08-15T06:00:04Z"

failureMessage
string

FailureMessage é a descrição de falha legível em texto livre (com PII sanitizada). Ausente para registros que não estão em FAILED.

failureReason
enum<string>

FailureReason categoriza uma falha terminal. Snapshot do FailureReason da entrada mais recente de Attempts[]. Ausente para registros que não estão em FAILED.

Opções disponíveis:
INSUFFICIENT_FUNDS,
BTG_REJECTED,
MIDAZ_REJECTED,
VALIDATION_FAILED,
SCHEDULE_STALE_TIMEOUT,
SCHEDULE_RETRIES_EXHAUSTED
Exemplo:

"INSUFFICIENT_FUNDS"

firedAt
string<date-time>

FiredAt é o instante de despacho mais recente. Ausente até que o agendamento inicie o processamento (PROCESSING / EXECUTED / FAILED).

Exemplo:

"2026-08-15T06:00:04Z"

id
string

ID é o identificador único do agendamento (UUID v7, gerado pela aplicação).

Exemplo:

"01989f9e-6508-79f8-9540-835be49fbd0d"

initiationId
string

InitiationID é a payment initiation referenciada no momento da criação (âncora de auditoria). Nunca é reutilizada no momento do disparo; cada tentativa de disparo usa sua própria initiation, exposta por tentativa como Attempts[].InitiationID.

Exemplo:

"550e8400-e29b-41d4-a716-446655440010"

initiationType
enum<string>

InitiationType registra como o destino foi capturado (MANUAL, KEY, QR_CODE).

Opções disponíveis:
MANUAL,
KEY,
QR_CODE
Exemplo:

"MANUAL"

maxAttempts
integer

MaxAttempts é o limite de retentativas por registro aceito no momento da criação.

Exemplo:

2

recurrenceId
string

RecurrenceID ecoa a âncora da recorrência pai quando o agendamento foi criado a partir de um fluxo recorrente. Vazio para chamadas diretas de POST /v1/schedules.

Exemplo:

"01988a7c-1234-7abc-8def-111122223333"

scheduledFor
string<date-time>

ScheduledFor é o momento de disparo em horário de relógio (ISO 8601 UTC).

Exemplo:

"2026-08-15T09:00:00Z"

status
enum<string>

Status é o status do ciclo de vida do agendamento. Sempre SCHEDULED na criação. Ciclo de vida: SCHEDULED -> PROCESSING -> EXECUTED | FAILED | CANCELLED.

Opções disponíveis:
SCHEDULED,
PROCESSING,
EXECUTED,
FAILED,
CANCELLED
Exemplo:

"SCHEDULED"

transferId
string

TransferID é o identificador da transferência liquidada. Preenchido apenas em EXECUTED.

Exemplo:

"c8d27e3f-4a5b-6c7d-8e9f-0a1b2c3d4e5f"

updatedAt
string<date-time>

UpdatedAt é a data/hora da última transição de status (ISO 8601 UTC).

Exemplo:

"2026-05-26T12:30:00Z"