> ## Documentation Index
> Fetch the complete documentation index at: https://altostrat.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a prefix list

> Creates a new prefix list with a defined set of CIDR blocks and initial site associations. Site associations and address list deployments are handled asynchronously.



## OpenAPI

````yaml /api/en/security-groups.yaml post /vpc/prefix-lists
openapi: 3.0.3
info:
  title: Altostrat Security Groups API
  version: 1.0.0
  description: >-
    The Altostrat Security Groups API is the microservice responsible for the
    centralized management of stateful firewall rulesets and reusable IP address
    collections.


    It serves as the source of truth for all network security policies within
    the Altostrat SDX platform, translating abstract rules into concrete
    configurations that are asynchronously deployed to MikroTik routers.


    This API allows you to programmatically manage:

    - **Security Groups:** Containers for stateful firewall rules that define
    allowed inbound and outbound traffic for associated network sites.

    - **Prefix Lists:** Reusable, named collections of IP addresses and CIDR
    blocks that can be referenced within Security Group rules to simplify policy
    management.


    Developers use this API to programmatically define, manage, and automate
    network security policies at scale across their entire MikroTik
    infrastructure.
servers:
  - url: https://v1.api.altostrat.io
    description: Production API Server
security: []
tags:
  - name: Security Groups
    description: Manage firewall rule containers and their associations with network sites.
  - name: Prefix Lists
    description: Manage reusable collections of IP addresses and CIDR blocks.
  - name: Reference Data
    description: Retrieve static data like supported protocols and services.
paths:
  /vpc/prefix-lists:
    post:
      tags:
        - Prefix Lists
      summary: Create a prefix list
      description: >-
        Creates a new prefix list with a defined set of CIDR blocks and initial
        site associations. Site associations and address list deployments are
        handled asynchronously.
      operationId: createPrefixList
      requestBody:
        description: The details of the new prefix list.
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PrefixListWrite'
      responses:
        '201':
          description: The prefix list was created successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PrefixList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
      security:
        - bearerAuth: []
components:
  schemas:
    PrefixListWrite:
      type: object
      description: Defines the writable properties for creating or updating a prefix list.
      required:
        - name
        - prefixes
        - sites
      properties:
        name:
          type: string
          maxLength: 255
          description: A human-readable name for the prefix list.
          example: Third-Party API Endpoints
        description:
          type: string
          maxLength: 1000
          nullable: true
          description: An optional description for the prefix list.
          example: Static IPs for services we integrate with.
        prefixes:
          type: array
          maxItems: 500
          description: >-
            A list of prefixes (CIDR blocks). The entire list is replaced on
            update.
          items:
            $ref: '#/components/schemas/PrefixWrite'
        sites:
          type: array
          description: >-
            A list of site IDs where this prefix list should be directly
            applied. The entire list of sites is replaced on update.
          items:
            type: string
            example: site_0ujsswThIGTUYm2K8FjOOfxcYpw
      example:
        name: Corporate Office IPs
        description: Static IPs for our main corporate office.
        prefixes:
          - cidr: 203.0.113.0/28
            description: Primary ISP Block
          - cidr: 198.51.100.10/32
            description: Backup ISP
        sites: []
    PrefixList:
      type: object
      description: Represents a reusable, named collection of IP addresses and CIDR blocks.
      properties:
        id:
          type: string
          description: >-
            The unique identifier for the prefix list, prefixed with
            `prfx_lst_`.
          readOnly: true
          example: prfx_lst_0ujsswThIGTUYm2K8FjOOfxcYpw
        name:
          type: string
          description: A human-readable name for the prefix list.
          example: Main Office IPs
        description:
          type: string
          description: An optional description for the prefix list.
          example: Public IP ranges for the main office.
        status:
          type: string
          description: The current synchronization status of the prefix list.
          readOnly: true
          enum:
            - active
            - syncing
            - failed
          example: active
        sites:
          type: array
          description: A list of site IDs where this prefix list is directly applied.
          items:
            type: string
            example: site_12345
        prefixes:
          type: array
          description: The list of CIDR blocks in this prefix list.
          items:
            $ref: '#/components/schemas/Prefix'
    PrefixWrite:
      type: object
      description: Defines the writable properties for a prefix.
      required:
        - cidr
      properties:
        cidr:
          type: string
          description: A valid IPv4 CIDR block.
          example: 203.0.113.0/24
        description:
          type: string
          maxLength: 500
          nullable: true
          description: An optional description for this prefix.
          example: Payment provider API IPs
    Prefix:
      type: object
      description: Represents a single IP address or CIDR block within a prefix list.
      properties:
        id:
          type: string
          description: The unique identifier for the prefix entry, prefixed with `prfx_`.
          readOnly: true
          example: prfx_0ujsswThIGTUYm2K8FjOOfxcYpw
        cidr:
          type: string
          description: The IP address range in CIDR notation.
          example: 192.0.2.0/24
        description:
          type: string
          description: An optional description for this specific prefix.
          example: Main server subnet
    ErrorResponse:
      type: object
      properties:
        type:
          type: string
          description: A broad category for the error (e.g., 'invalid_request_error').
          example: invalid_request_error
        code:
          type: string
          description: A short, unique string identifying the specific error.
          example: parameter_missing
        message:
          type: string
          description: A human-readable description of what went wrong.
          example: The 'name' parameter is required for this request.
        doc_url:
          type: string
          description: >-
            A direct link to the documentation page for this specific error
            code.
          example: https://docs.altostrat.io/errors/parameter_missing
  responses:
    BadRequest:
      description: >-
        Bad Request - The request was malformed, for example, due to invalid
        JSON.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: >-
        Unauthorized - The request requires authentication, and a valid Bearer
        token was not provided.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    UnprocessableEntity:
      description: >-
        Unprocessable Entity - The request was well-formed but was unable to be
        followed due to semantic errors (e.g., validation failed).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    InternalServerError:
      description: Internal Server Error - An unexpected error occurred on the server.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Authentication is performed via an Auth0-issued JSON Web Token (JWT).
        Provide the token in the `Authorization` header with the `Bearer`
        scheme.

````