Skip to content

BGP API ​

Submit ASNs and create or delete BGP sessions. In Flux, see BGP and Servers → BGP.

All endpoints require Bearer-token authentication.

GET /bgp ​

The response contains:

  • asn: every ASN on the account, whatever its state, with IRR information, status, rejected_reason and auth_token. An ASN waiting for verification has status pending.
  • prefix_lists: the IPv4 and IPv6 prefix lists.
  • sessions: configured BGP sessions across all servers.
bash
curl https://api.gigahost.no/api/v0/bgp \
  -H "Authorization: Bearer $TOKEN"

POST /bgp/asn ​

Submit an ASN for approval. Maximum 5 ASNs per customer.

The body is form-encoded (application/x-www-form-urlencoded), not JSON.

FieldTypeDescription
asnnumber or string212345 or AS212345 (the AS prefix is optional).
bash
curl -X POST https://api.gigahost.no/api/v0/bgp/asn \
  -H "Authorization: Bearer $TOKEN" \
  -d 'asn=AS212345'

Response:

json
{
  "meta": {
    "status": 200,
    "status_message": "200 OK",
    "message": "ASN and LOA has been submitted for review."
  },
  "data": {
    "id": 42,
    "asn": 212345,
    "asn_name": "EXAMPLE-AS",
    "asn_country": "NO",
    "status": "pending",
    "auth_token": "<40 hex characters>"
  }
}

Add auth_token to the aut-num object for the ASN at your RIR. The token is also emailed to the account's email address and returned in GET /bgp. Gigahost checks the token and approves the ASN manually; until then status stays pending.

The limit counts every ASN on the account, rejected ones included. Only support can remove an ASN.

Errors (400):

  • ASN is not valid
  • Only five ASNs can be configured at a time. Contact support to remove an ASN first.
  • The ASN already exists in the database. (the ASN is already on your account)

POST /bgp/{asn_id}/session ​

Create a BGP peering session for an approved ASN. {asn_id} is the ID from GET /bgp, not the AS number.

FieldTypeDescription
redundantnumber0 or 1.
defaultroutenumber0 (full table) or 1 (default route only).
ip_id_v4numberOptional. IPv4 ID for the local endpoint.
ip_id_v6numberOptional. IPv6 ID for the local endpoint.

At least one of ip_id_v4 or ip_id_v6 must be provided.

bash
curl -X POST https://api.gigahost.no/api/v0/bgp/42/session \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "redundant": 0,
    "defaultroute": 0,
    "ip_id_v4": 12345,
    "ip_id_v6": 12346
  }'

DELETE /bgp/{session_id}/session ​

Mark a session for deletion. Deletion is processed asynchronously: the session enters a Deletion state and is removed from the router on the next pass.

bash
curl -X DELETE https://api.gigahost.no/api/v0/bgp/9001/session \
  -H "Authorization: Bearer $TOKEN"

Gigahost Docs

This site is currently in development.
Enter the password to continue.