Use this when allocating addresses automatically.
IP Allocation
IP allocation automation picks the next free address or prefix from the right pool, marks it as used atomically to avoid two jobs taking the same one, and releases it when the system is removed.
1. Allocate IPs via API (available-ips/available-prefixes).
2. Check for existing allocations first (idempotency).
3. Tag/describe owner.
4. Release on decommission.
5. Sync DNS.
request → available-ips → allocated IP
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Common mistakes Narrow the fault
- Reading the free list and then creating the IP in a second call (race).
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Allocation must be atomic to avoid duplicates.
- Allocate from the correct pool or prefix.
- Release addresses on decommission.
curl -s -X POST -H 'Authorization: Token <t>' -H 'Content-Type: application/json' -d '{"description":"vm01"}' https://<netbox>/api/ipam/prefixes/<id>/available-ips/— allocate next IP- Idempotency (check existing by name/tag first) — no duplicates
- Release on decommission — cleanup
ReferenceWhy it matters1 section · depth on demand
What it is
IP allocation requests the next free address or prefix from IPAM via API, atomically.
ReferenceImportant terms & boundaries2 sections · depth on demand
How it works
Atomic allocation means the IPAM picks and records the address in one API call, so two parallel jobs never get the same IP. NetBox does this with POST to available-ips or available-prefixes.
Example
curl -X POST -H "Authorization: Token $T" -H 'Content-Type: application/json' \
https://netbox.example.com/api/ipam/prefixes/12/available-ips/ -d '{"dns_name":"web01.example.com"}'
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in IPAM Automation > IP Allocation. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://netbox.readthedocs.io/en/stable/models/ipam/ · confidence 94%