curl · bash · CI/CD
Gerador de Chave PIX via curl
API REST do FakeForge gera os 4 tipos de chave PIX BACEN. Zero SDK, só curl e jq. Snippets pra bash, GitHub Actions, GitLab CI, Jenkins.
TL;DR
# Chaves aleatórias (mix dos 4 tipos)
curl "https://fakeforge.com.br/api/generate?type=pixKey&quantity=100"
# Preset fintech (customer + PIX + banco + cartão coerentes)
curl "https://fakeforge.com.br/api/generate?preset=fintech&quantity=50"GitHub Actions — teste E2E de PIX
# .github/workflows/e2e-pix.yml
name: E2E PIX
on: [pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Fetch 20 chaves PIX
run: |
curl -s "https://fakeforge.com.br/api/generate?type=pixKey&quantity=20" \
| jq '.data' > tests/fixtures/pix-keys.json
- name: Roda testes de transferência
run: npm test -- --testPathPattern=pixBash script (seed banco de teste)
#!/bin/bash
# seed-pix-keys.sh
set -euo pipefail
# Fetch 100 chaves PIX aleatórias
curl -s "https://fakeforge.com.br/api/generate?type=pixKey&quantity=100" \
| jq -r '.data[]' > pix-keys.txt
# Insere no Postgres
while read chave; do
psql -d myapp_dev -c "INSERT INTO pix_keys(chave) VALUES ('$chave');"
done < pix-keys.txt
echo "100 chaves PIX seeded em myapp_dev"Preset fintech (banco + PIX + cartão coerentes)
# Retorna clientes com PIX correlacionado (CPF do cliente vira chave)
curl -s "https://fakeforge.com.br/api/generate?preset=fintech&quantity=10" \
| jq '.data[] | {
cpf: .customer.cpf,
email: .customer.email,
pix_keys: .pix_keys | map(.type + ": " + .value)
}'
# Output:
# {
# "cpf": "123.456.789-09",
# "email": "marina.souza@gmail.com",
# "pix_keys": [
# "cpf: 12345678909",
# "email: marina.souza@gmail.com",
# "phone: +5511987654321",
# "aleatoria: 8f4e2c91-a3b7-4d5e-9f2a-1c8b6d0e5a3f"
# ]
# }GitLab CI
# .gitlab-ci.yml
seed_pix_staging:
image: alpine:latest
before_script:
- apk add --no-cache curl jq postgresql-client
script:
- curl -sH "X-API-Key: $FF_KEY" \
"https://fakeforge.com.br/api/generate?preset=fintech&quantity=500" \
> fintech.json
- node scripts/import-fintech.js fintech.json
only:
- schedules