← All Docs

API Keys & Automation

Programmatic access to your IPCraft data for scripts, CI/CD, and integrations.

Generating a Key

  1. Go to Settings in the IPCraft app
  2. Scroll to the API Keys section
  3. Click Generate Key
  4. Enter a name (e.g., "CI/CD Pipeline", "Monitoring Script")
  5. Copy the key immediately
The full API key is shown only once. If you lose it, you'll need to generate a new one.

Keys are prefixed with ipc_ for easy identification. The key prefix (first 12 characters) is visible in the settings page for reference.

Using Your Key

Include the key in the Authorization header:

curl https://api.ipcraft.io/api/v1/subnets \
  -H "Authorization: Bearer ipc_a1b2c3d4e5f6..."

API key requests don't need the X-Requested-With header (that's only for browser session auth).

Permissions

API key permissions depend on your plan:

Example: List Subnets

curl -s https://api.ipcraft.io/api/v1/subnets \
  -H "Authorization: Bearer ipc_your_key_here" \
  | python3 -m json.tool

Example: Assign an IP

curl -X POST https://api.ipcraft.io/api/v1/subnets/{subnet_id}/addresses \
  -H "Authorization: Bearer ipc_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "ip": "10.0.1.50",
    "hostname": "web-server-03",
    "status": "assigned",
    "owner": "ops-team"
  }'

Example: Find Next Available IP

curl -s https://api.ipcraft.io/api/v1/subnets/{subnet_id}/first-free \
  -H "Authorization: Bearer ipc_your_key_here"

# Response: {"ip": "10.0.1.51"}

Example: Bash Script

#!/bin/bash
# Assign the next available IP in a subnet
API="https://api.ipcraft.io/api/v1"
KEY="ipc_your_key_here"
SUBNET_ID="your-subnet-uuid"

# Get next free IP
FREE_IP=$(curl -s "$API/subnets/$SUBNET_ID/first-free" \
  -H "Authorization: Bearer $KEY" | jq -r '.ip')

if [ "$FREE_IP" = "null" ]; then
  echo "No available IPs"
  exit 1
fi

# Assign it
curl -X POST "$API/subnets/$SUBNET_ID/addresses" \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d "{\"ip\": \"$FREE_IP\", \"hostname\": \"$(hostname)\", \"status\": \"assigned\"}"

echo "Assigned $FREE_IP"

Revoking Keys

Click the trash icon next to any key in Settings to revoke it immediately. Revoked keys stop working instantly.

For security, rotate your API keys periodically and use separate keys for different integrations so you can revoke one without affecting others.

Rate Limits

API key requests share the same rate limits as the web application. There are no separate per-key rate limits at this time.

See the full API reference for all available endpoints.