cURL & Scripts
Postbox endpoints are plain HTTP - perfect for cURL, shell scripts, cron jobs, and CI pipelines.
Basic cURL
Section titled “Basic cURL”curl -X POST "https://usepostbox.com/api/.../f/{slug}" \ -H "Content-Type: application/json" \ -d '{"rating": 5, "comment": "Great product"}'From a shell script
Section titled “From a shell script”#!/bin/bash# deploy-notify.sh - Notify on successful deploy
ENDPOINT="https://usepostbox.com/api/.../f/{slug}"VERSION=$(git describe --tags --always)BRANCH=$(git rev-parse --abbrev-ref HEAD)DEPLOYER=$(whoami)
curl -s -X POST "$ENDPOINT" \ -H "Content-Type: application/json" \ -d "{ \"version\": \"$VERSION\", \"branch\": \"$BRANCH\", \"deployer\": \"$DEPLOYER\", \"timestamp\": \"$(date -u +%Y-%m-%dT%H:%M:%SZ)\" }"From a cron job
Section titled “From a cron job”Collect system metrics every hour:
# crontab -e0 * * * * /path/to/collect-metrics.sh#!/bin/bashENDPOINT="https://usepostbox.com/api/.../f/{slug}"LOAD=$(uptime | awk -F'load average:' '{print $2}' | awk '{print $1}' | tr -d ',')DISK=$(df -h / | tail -1 | awk '{print $5}')
curl -s -X POST "$ENDPOINT" \ -H "Content-Type: application/json" \ -d "{\"hostname\": \"$(hostname)\", \"load\": \"$LOAD\", \"disk_usage\": \"$DISK\"}"From CI/CD
Section titled “From CI/CD”Report build results to Postbox:
# GitHub Actions example- name: Report to Postbox if: always() run: | curl -s -X POST "$POSTBOX_ENDPOINT" \ -H "Content-Type: application/json" \ -d "{ \"repo\": \"${{ github.repository }}\", \"branch\": \"${{ github.ref_name }}\", \"status\": \"${{ job.status }}\", \"commit\": \"${{ github.sha }}\", \"run_url\": \"${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}\" }" env: POSTBOX_ENDPOINT: ${{ secrets.POSTBOX_ENDPOINT }}Using the management API
Section titled “Using the management API”For reading submissions or managing forms from scripts, use your API key:
# List recent submissionscurl "https://usepostbox.com/api/forms/{form_id}/submissions" \ -H "Authorization: Bearer {api_key}" | jq '.data[:5]'