> ## 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.

# Set publish state on a BASE network

> Publishes one of your base networks to the whole platform — or begins withdrawing it. Publishing makes the network automatically visible to every organization on Spirii, so they can build slices of it for their own drivers. Publishing requires that Spirii has granted your organization the publishing capability. Withdrawing is deliberately gradual: the network enters a wind-down period (30 days by default) during which it stays visible so organizations using it have time to migrate. Requesting the state the network is already in returns an error rather than silently doing nothing.



## OpenAPI

````yaml /openapi/emsp-network/openapi.yaml patch /emsp/v1/networks/{network_id}/publish-state
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/{network_id}/publish-state:
    patch:
      tags:
        - Networks
      summary: Set publish state on a BASE network
      description: >-
        Publishes one of your base networks to the whole platform — or begins
        withdrawing it. Publishing makes the network automatically visible to
        every organization on Spirii, so they can build slices of it for their
        own drivers. Publishing requires that Spirii has granted your
        organization the publishing capability. Withdrawing is deliberately
        gradual: the network enters a wind-down period (30 days by default)
        during which it stays visible so organizations using it have time to
        migrate. Requesting the state the network is already in returns an error
        rather than silently doing nothing.
      operationId: NetworkController_setPublishState_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
        - name: network_id
          required: true
          in: path
          description: The unique ID of the base network to publish or withdraw.
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SetPublishStateDto'
      responses:
        '200':
          description: The base network with its updated publish state.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NetworkResponse'
        '409':
          description: Network is not BASE or already in the requested state.
        '422':
          description: Validation error
components:
  schemas:
    SetPublishStateDto:
      type: object
      properties:
        published:
          type: boolean
          description: Desired publish state for the base network
        unpublish_drain_until:
          type: string
          format: date-time
          description: >-
            Override for the drain deadline (ISO 8601). Must not be more than a
            minute in the past if set; only valid when published is false.
            Defaults to 30 days from now.
      required:
        - published
    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)

````