Skip to main content

prefixes

Creates, updates, deletes, gets or lists a prefixes resource.

Overview

Nameprefixes
TypeResource
Idcloudflare.addressing.prefixes

Fields

The following fields are returned by SELECT queries:

Prefix Details response

NameDatatypeDescription
idstringIdentifier of an IP Prefix. (example: 2af39739cc4e3b5910c918468bb89828)
account_idstringIdentifier of a Cloudflare account. (example: 258def64c72dae45f3e4c8516e2111f2)
loa_document_idstringIdentifier for the uploaded LOA document. (example: d933b1530bc56c9953cf8ce166da8004)
advertisedbooleanPrefix advertisement status to the Internet. This field is only not 'null' if on demand is enabled. (x-stainless-deprecation-message: Prefer the BGP Prefixes API instead, which allows for advertising multiple BGP routes within a single IP Prefix.)
advertised_modified_atstring (date-time)Last time the advertisement status was changed. This field is only not 'null' if on demand is enabled. (example: 2014-01-01T05:20:00.12345Z, x-stainless-deprecation-message: Prefer the BGP Prefixes API instead, which allows for advertising multiple BGP routes within a single IP Prefix.)
approvedstringApproval state of the prefix (P = pending, V = active). (example: P)
asnintegerAutonomous System Number (ASN) the prefix will be advertised under.
cidrstringIP Prefix in Classless Inter-Domain Routing format. (example: 192.0.2.0/24)
created_atstring (date-time) (example: 2014-01-01T05:20:00.12345Z)
delegate_loa_creationbooleanWhether Cloudflare is allowed to generate the LOA document on behalf of the prefix owner.
descriptionstringDescription of the prefix. (example: Internal test prefix)
irr_validation_statestringState of one kind of validation for an IP prefix. (example: pending)
modified_atstring (date-time) (example: 2014-01-01T05:20:00.12345Z)
on_demand_enabledbooleanWhether advertisement of the prefix to the Internet may be dynamically enabled or disabled. (x-stainless-deprecation-message: Prefer the BGP Prefixes API instead, which allows for advertising multiple BGP routes within a single IP Prefix.)
on_demand_lockedbooleanWhether advertisement status of the prefix is locked, meaning it cannot be changed. (x-stainless-deprecation-message: Prefer the BGP Prefixes API instead, which allows for advertising multiple BGP routes within a single IP Prefix.)
ownership_validation_statestringState of one kind of validation for an IP prefix. (example: pending)
ownership_validation_tokenstringToken provided to demonstrate ownership of the prefix. (example: 1234a5b6-1234-1abc-12a3-1234a5b6789c)
rpki_validation_statestringState of one kind of validation for an IP prefix. (example: pending)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectprefix_id, account_idList a particular prefix owned by the account.
listselectaccount_idList all prefixes owned by the account.
createinsertaccount_id, cidr, asnAdd a new prefix under the account.
editupdateprefix_id, account_id, descriptionModify the description for a prefix owned by the account.
ip_address_management_prefixes_delete_bgp_prefixdeleteaccount_id, prefix_id, bgp_prefix_idDelete a BGP Prefix associated with the specified IP Prefix. A BGP Prefix must be withdrawn before it can be deleted.
deletedeleteprefix_id, account_idDelete an unapproved prefix owned by the account.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
account_idstringThe Cloudflare account ID.
bgp_prefix_idstring
prefix_idstringThe IP prefix ID.

SELECT examples

List a particular prefix owned by the account.

SELECT
id,
account_id,
loa_document_id,
advertised,
advertised_modified_at,
approved,
asn,
cidr,
created_at,
delegate_loa_creation,
description,
irr_validation_state,
modified_at,
on_demand_enabled,
on_demand_locked,
ownership_validation_state,
ownership_validation_token,
rpki_validation_state
FROM cloudflare.addressing.prefixes
WHERE prefix_id = '{{ prefix_id }}' -- required
AND account_id = '{{ account_id }}' -- required
;

INSERT examples

Add a new prefix under the account.

INSERT INTO cloudflare.addressing.prefixes (
asn,
cidr,
delegate_loa_creation,
description,
loa_document_id,
account_id
)
SELECT
{{ asn }} /* required */,
'{{ cidr }}' /* required */,
{{ delegate_loa_creation }},
'{{ description }}',
'{{ loa_document_id }}',
'{{ account_id }}'
RETURNING
errors,
messages,
result,
success
;

UPDATE examples

Modify the description for a prefix owned by the account.

UPDATE cloudflare.addressing.prefixes
SET
description = '{{ description }}'
WHERE
prefix_id = '{{ prefix_id }}' --required
AND account_id = '{{ account_id }}' --required
AND description = '{{ description }}' --required
RETURNING
errors,
messages,
result,
success;

DELETE examples

Delete a BGP Prefix associated with the specified IP Prefix. A BGP Prefix must be withdrawn before it can be deleted.

DELETE FROM cloudflare.addressing.prefixes
WHERE account_id = '{{ account_id }}' --required
AND prefix_id = '{{ prefix_id }}' --required
AND bgp_prefix_id = '{{ bgp_prefix_id }}' --required
;