curl · bash · CI/CD

Gerador de CPF via curl

Se seu pipeline não tem Node ou Python, ou você prefere ficar em bash puro, a API REST do FakeForge cobre. curl retorna JSON pronto pra jq. Sem SDK, sem instalação, sem dep. Ideal pra scripts, GitHub Actions, GitLab CI, Jenkins e CircleCI.

TL;DR

# 10 CPFs formatados
curl "https://fakeforge.com.br/api/generate?type=cpf&quantity=10"

# Só o array de CPFs (com jq)
curl -s "https://fakeforge.com.br/api/generate?type=cpf&quantity=10" | jq -r '.data[]'

Free 50 chamadas/dia por IP. Sem cadastro.

Todos os tipos suportados via curl

# CPF válido mod-11
curl "https://fakeforge.com.br/api/generate?type=cpf&quantity=100"

# CNPJ válido mod-11
curl "https://fakeforge.com.br/api/generate?type=cnpj&quantity=50"

# CNPJ alfanumérico 2026 (IN RFB 2.229)
curl "https://fakeforge.com.br/api/generate?type=cnpjAlfa&quantity=20"

# CEP + endereço
curl "https://fakeforge.com.br/api/generate?type=address&quantity=10"

# Preset customer (pessoa correlacionada)
curl "https://fakeforge.com.br/api/generate?preset=customer&quantity=100"

# Preset fintech (cliente + PIX + banco + cartão + score)
curl "https://fakeforge.com.br/api/generate?preset=fintech&quantity=50"

Com autenticação (plano Dev)

# Header X-API-Key libera 10k chamadas/dia (plano Dev R$29/mês)
curl -H "X-API-Key: ff_sua_key_aqui" \
  "https://fakeforge.com.br/api/generate?type=cpf&quantity=10000"

GitHub Actions

# .github/workflows/seed-staging.yml
name: Seed staging with fresh CPFs
on:
  schedule:
    - cron: "0 3 * * *"  # 3h AM UTC daily
  workflow_dispatch:

jobs:
  seed:
    runs-on: ubuntu-latest
    steps:
      - name: Fetch 1000 CPFs from FakeForge
        env:
          FF_KEY: ${{ secrets.FAKEFORGE_KEY }}
        run: |
          curl -sH "X-API-Key: $FF_KEY" \
            "https://fakeforge.com.br/api/generate?type=cpf&quantity=1000" \
            > cpfs.json

      - name: Import to staging DB
        run: psql $STAGING_URL -c "COPY users(cpf) FROM 'cpfs.json' WITH (FORMAT csv);"

GitLab CI

# .gitlab-ci.yml
seed_staging:
  stage: test
  image: alpine:latest
  before_script:
    - apk add --no-cache curl jq
  script:
    - curl -s "https://fakeforge.com.br/api/generate?preset=customer&quantity=500" | jq '.data' > customers.json
    - ./scripts/import-customers.sh customers.json
  only:
    - schedules

Jenkins Pipeline

// Jenkinsfile
pipeline {
  agent any
  stages {
    stage('Seed staging') {
      steps {
        withCredentials([string(credentialsId: 'FF_KEY', variable: 'FF_KEY')]) {
          sh '''
            curl -sH "X-API-Key: $FF_KEY" \
              "https://fakeforge.com.br/api/generate?preset=fintech&quantity=1000" \
              > fintech.json

            python3 scripts/import_fintech.py fintech.json
          '''
        }
      }
    }
  }
}

Bash puro (script local)

#!/bin/bash
# seed-local.sh - gera dados e importa em Postgres local

set -euo pipefail

# 1. Gera 500 CPFs
CPFS=$(curl -s "https://fakeforge.com.br/api/generate?type=cpf&quantity=500" | jq -r '.data[]')

# 2. Importa via psql
psql -d myapp_dev -c "TRUNCATE users;"
echo "$CPFS" | while read cpf; do
  psql -d myapp_dev -c "INSERT INTO users(cpf) VALUES ('$cpf');"
done

echo "Seeded $(echo "$CPFS" | wc -l) CPFs em myapp_dev"

Formatos de resposta

# JSON (default)
curl "https://fakeforge.com.br/api/generate?type=cpf&quantity=3"
# {"type":"cpf","quantity":3,"data":["123.456.789-09","234.567.890-10","345.678.901-21"]}

# CSV (útil pra importar em DB direto)
curl "https://fakeforge.com.br/api/generate?type=cpf&quantity=100&format=csv"

# SQL INSERT statements
curl "https://fakeforge.com.br/api/generate?type=cpf&quantity=100&format=sql"

Rate limit e headers

# Response headers incluem quota atual
curl -I "https://fakeforge.com.br/api/generate?type=cpf&quantity=1"

# X-RateLimit-Limit: 50
# X-RateLimit-Remaining: 47
# X-RateLimit-Reset: 1734589200

# Se estourou quota (HTTP 429), response body traz upgrade URL
# {"error":"rate_limit","upgrade":"https://fakeforge.com.br/pricing"}

Próximos passos