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

# Create a TENANT sub-network

> Creates a named slice of a base network — for example "Fleet fast chargers" or "Premium partners" — which you can then assign to a group of charging tokens so those drivers see only these operators. The operators you pick must all be part of the chosen parent network. Supply an idempotency key to prevent duplicate creation on retry. If the parent network is in the middle of being withdrawn from publication, new slices of it cannot be created.



## OpenAPI

````yaml /openapi/emsp-network/openapi.yaml post /emsp/v1/networks
openapi: 3.0.0
info:
  title: Spirii EMSP - Network & Access Control API
  description: >-
    Manages network access and location visibility for secure multi-tenant
    operation.
  version: v1
  contact: {}
servers:
  - url: https://api.spirii.com
    description: Production
security:
  - OAuth2ClientCredentials: []
tags:
  - name: Networks
    description: Network lifecycle management
paths:
  /emsp/v1/networks:
    post:
      tags:
        - Networks
      summary: Create a TENANT sub-network
      description: >-
        Creates a named slice of a base network — for example "Fleet fast
        chargers" or "Premium partners" — which you can then assign to a group
        of charging tokens so those drivers see only these operators. The
        operators you pick must all be part of the chosen parent network. Supply
        an idempotency key to prevent duplicate creation on retry. If the parent
        network is in the middle of being withdrawn from publication, new slices
        of it cannot be created.
      operationId: NetworkController_create_v1
      parameters:
        - name: Idempotency-Key
          in: header
          description: >-
            Client-generated unique key per operation intent (UUID). Same key +
            identical body replays the original response; same key + different
            body returns 409.
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSubNetworkDto'
      responses:
        '201':
          description: The created sub-network. Fires network.created webhook.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NetworkResponse'
        '422':
          description: PUBLISHED_NETWORK_DRAINING or validation error
components:
  schemas:
    CreateSubNetworkDto:
      type: object
      properties:
        name:
          type: string
          maxLength: 255
        parent_network_id:
          type: string
          format: uuid
          description: Parent BASE network ID
        cpo_ids:
          description: Operator IDs of CPOs belonging to this sub network
          type: array
          items:
            type: string
        description:
          type: string
          maxLength: 1000
        countries:
          description: Countries covered by this sub network
          type: array
          items:
            type: string
        power_types:
          description: Power types available in this sub network
          type: array
          items:
            type: string
        parking_types:
          description: Parking types available in this sub network
          type: array
          items:
            type: string
        facilities:
          description: Facilities available in this sub network
          type: array
          items:
            type: string
        auto_accept_cpo_additions:
          type: boolean
          default: false
          description: >-
            When true, cpo_ids added to the parent BASE network are
            automatically added to this sub network.
        publicly_accessible:
          type: boolean
          default: false
          description: >-
            When true, this sub network's locations appear in anonymous location
            discovery.
      required:
        - name
        - parent_network_id
        - cpo_ids
    NetworkResponse:
      type: object
      properties:
        network_id:
          type: string
          format: uuid
          description: Network identifier.
        name:
          type: string
          description: >-
            BASE network name (auto-derived from the emp_identity and immutable)
            or the creator-set SUB network name.
        network_type:
          description: Network kind.
          allOf:
            - $ref: '#/components/schemas/NetworkType'
        published:
          type: boolean
          description: >-
            Whether a BASE network is currently published. Always false for SUB
            networks.
        publish_state:
          nullable: true
          description: Publish lifecycle state for BASE networks; null for SUB networks.
          allOf:
            - $ref: '#/components/schemas/PublishState'
        unpublish_started_at:
          type: string
          format: date-time
          nullable: true
          description: When the current unpublish (drain) was started, if any.
        unpublish_drain_until:
          type: string
          format: date-time
          nullable: true
          description: >-
            When the unpublish drain window ends, after which the network is
            fully unpublished.
        tenant_id:
          type: string
          format: uuid
          description: Owning tenant identifier.
        emp_identity_id:
          type: string
          format: uuid
          description: emp_identity the network belongs to.
        description:
          type: string
          nullable: true
          description: Free-text description.
        cpo_ids:
          description: Operator IDs (eMI3, e.g. `DK*SPI`) of the CPOs in this network.
          type: array
          items:
            type: string
        protocol:
          description: Roaming protocols carried by the network.
          type: array
          items:
            type: string
        roaming_hub:
          description: Roaming hubs the network is reachable through.
          type: array
          items:
            type: string
        publicly_accessible:
          type: boolean
          description: Whether the network is publicly accessible.
        parent_network_id:
          type: string
          format: uuid
          nullable: true
          description: Parent BASE network for a SUB network; null for BASE networks.
        countries:
          description: ISO 3166-1 country codes the network covers.
          type: array
          items:
            type: string
        power_types:
          description: Power types the network filters on.
          type: array
          items:
            type: string
        parking_types:
          description: Parking types the network filters on.
          type: array
          items:
            type: string
        facilities:
          description: Facilities the network filters on.
          type: array
          items:
            type: string
        auto_accept_cpo_additions:
          type: boolean
          description: Whether newly-available CPOs are auto-accepted into the network.
        created_at:
          type: string
          format: date-time
          description: Creation timestamp (UTC).
        updated_at:
          type: string
          format: date-time
          description: Last-update timestamp (UTC).
      required:
        - network_id
        - name
        - network_type
        - published
        - publish_state
        - unpublish_started_at
        - unpublish_drain_until
        - tenant_id
        - emp_identity_id
        - description
        - cpo_ids
        - protocol
        - roaming_hub
        - publicly_accessible
        - parent_network_id
        - countries
        - power_types
        - parking_types
        - facilities
        - auto_accept_cpo_additions
        - created_at
        - updated_at
    NetworkType:
      type: string
      enum:
        - BASE
        - SUB
      description: Network kind.
    PublishState:
      type: string
      enum:
        - PUBLISHED
        - UNPUBLISHED
        - UNPUBLISHING
      description: Publish lifecycle state for BASE networks; null for SUB networks.
  securitySchemes:
    OAuth2ClientCredentials:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: /oauth/token
          scopes:
            emsp:networks:read: View network and access control configuration
            emsp:networks:write: Create/update/delete SUB networks, manage access rules
            emsp:networks:publish: Publish/drain networks (PATCH /networks/:id/publish-state)

````