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

# Rimuovi una location da un cluster

> Rimuove una location dall'elenco `locationIds` di un cluster. È
un'alternativa atomica a `PATCH /clusters/{clusterId}` con un array
`locationIds` più corto, così rimozioni concorrenti non possono
entrare in conflitto tra loro.

Un cluster deve avere sempre almeno una location membro. Rimuovere
l'ultima fallisce con `400 CLUSTER_EMPTY`. In quel caso, elimina il
cluster con `DELETE /clusters/{clusterId}`.




## OpenAPI

````yaml api-reference/energy-management/openapi.it.yaml DELETE /clusters/{clusterId}/locations/{locationId}
openapi: 3.1.0
info:
  title: RiDERgy Energy Management API
  version: '1.0'
  license:
    name: Proprietary
    identifier: LicenseRef-Proprietary
  description: >
    Controllo programmatico dei limiti di potenza di ricarica su location,

    singoli charger, organizzazioni e cluster cross-location.


    ## Autenticazione

    Ogni endpoint, eccetto `GET /health` e `POST /oauth/token`, richiede un

    token Bearer ottenuto tramite il flusso OAuth 2.0 client_credentials:


    1. Crea le credenziali client OAuth nella dashboard RiDERgy.

    2. Scambiale per un access token di breve durata tramite `POST
    /oauth/token`.

    3. Passa il token come `Authorization: Bearer <token>` ad ogni richiesta.


    I token scadono dopo 3600 secondi. Il tuo tenant è incorporato nel token

    e non può essere falsificato. Le credenziali di un tenant non possono

    accedere a un altro.


    Il tuo tenant deve avere abilitata la funzionalità Energy Management API,

    altrimenti le richieste falliscono con `403 FEATURE_NOT_ENABLED`. Contatta

    RiDERgy per abilitarla.


    ## Scopes

    I token contengono scopes che controllano quali endpoint sono accessibili:

    `locations:read`, `locations:write`, `clusters:read`, `clusters:write`,

    `chargers:write`, `org:write`. Le richieste verso endpoint che richiedono

    uno scope non presente nel token falliranno con `403 INSUFFICIENT_SCOPE`.


    ## Modello di priorità

    I limiti di location e charger sono controllati tramite **profili con

    finestre di priorità**:


    - Le priorità vanno da **0 (più bassa) a 10 (più alta)**, in stile stack
      OCPP.
    - Un target (location o connettore del charger) può avere fino a 11
      profili, uno per livello di priorità, ciascuno con la propria finestra
      `[startTime, endTime)`.
    - In ogni momento, il **limite effettivo** è il `limitKw` del profilo a
      priorità più alta la cui finestra è attualmente attiva.
    - Se nessun profilo è attivo, una location ricade sul proprio
      `permanentLimitKw`.
    - L'invio di un profilo a una priorità che ne ha già uno per quel target
      lo **sostituisce**.
    - I profili vengono applicati e ripristinati automaticamente in base a
      `startTime`/`endTime`. Una volta creato un profilo non sono necessarie
      ulteriori chiamate API. I record dei profili non vengono mai eliminati,
      quindi la cronologia rimane interrogabile.

    ## Errori

    Tutti gli errori condividono questa struttura:


    ```json

    {
      "error": {
        "code": "LOCATION_NOT_FOUND",
        "message": "Location 123 was not found for the provided tenant",
        "requestId": "b1f6e6b0-..."
      }
    }

    ```
servers:
  - url: https://api.ridergy.com/v1
    description: Production
security:
  - BearerAuth: []
tags:
  - name: Auth
    description: Endpoint token OAuth 2.0 per il grant client_credentials.
  - name: Health
    description: Controllo dello stato del servizio non autenticato.
  - name: Locations
    description: >-
      Leggi e imposta i limiti di potenza e i profili di priorità a livello di
      location.
  - name: Chargers
    description: >-
      Blocca singoli connettori del charger su un limite di potenza fisso per
      una finestra temporale.
  - name: Organizations
    description: >-
      Profili di cap a livello di tenant (solo registrati, l'enforcement non è
      ancora attivo).
  - name: Clusters
    description: >-
      Raggruppa location sotto un cap kW condiviso e applica schedulazioni su di
      esse.
paths:
  /clusters/{clusterId}/locations/{locationId}:
    delete:
      tags:
        - Clusters
      summary: Remove a location from a cluster
      description: |
        Rimuove una location dall'elenco `locationIds` di un cluster. È
        un'alternativa atomica a `PATCH /clusters/{clusterId}` con un array
        `locationIds` più corto, così rimozioni concorrenti non possono
        entrare in conflitto tra loro.

        Un cluster deve avere sempre almeno una location membro. Rimuovere
        l'ultima fallisce con `400 CLUSTER_EMPTY`. In quel caso, elimina il
        cluster con `DELETE /clusters/{clusterId}`.
      operationId: removeClusterLocation
      parameters:
        - $ref: '#/components/parameters/ClusterId'
        - $ref: '#/components/parameters/LocationId'
      responses:
        '200':
          description: Location rimossa, cluster aggiornato restituito
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Cluster'
        '400':
          description: Al cluster rimane solo una location
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                clusterEmpty:
                  summary: CLUSTER_EMPTY
                  value:
                    error:
                      code: CLUSTER_EMPTY
                      message: >-
                        Cannot remove the last location from a cluster; delete
                        the cluster instead
                      requestId: b1f6e6b0-1234-4abc-9def-000000000000
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/FeatureNotEnabled'
        '404':
          description: Cluster non trovato, oppure la location non ne è membro
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                clusterNotFound:
                  summary: CLUSTER_NOT_FOUND
                  value:
                    error:
                      code: CLUSTER_NOT_FOUND
                      message: Cluster clst_20260612_a1b2c3d4 not found
                      requestId: b1f6e6b0-1234-4abc-9def-000000000000
                clusterLocationNotFound:
                  summary: CLUSTER_LOCATION_NOT_FOUND
                  value:
                    error:
                      code: CLUSTER_LOCATION_NOT_FOUND
                      message: >-
                        Location 3632155 is not a member of cluster
                        clst_20260612_a1b2c3d4
                      requestId: b1f6e6b0-1234-4abc-9def-000000000000
components:
  parameters:
    ClusterId:
      name: clusterId
      description: L'identificativo univoco del cluster, restituito alla sua creazione.
      in: path
      required: true
      schema:
        type: string
      example: clst_20260612_a1b2c3d4
    LocationId:
      name: locationId
      description: L'identificativo univoco della sede.
      in: path
      required: true
      schema:
        type: string
      example: '3632155'
  schemas:
    Cluster:
      type: object
      properties:
        clusterId:
          type: string
          example: clst_20260612_a1b2c3d4
        tenantUuid:
          type: string
        name:
          type: string
          example: North Campus
        locationIds:
          type: array
          items:
            type: string
          example:
            - '3632155'
            - '3632156'
        limitKw:
          type:
            - number
            - 'null'
          example: 200
        status:
          type: string
          enum:
            - ACTIVE
            - INACTIVE
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: LOCATION_NOT_FOUND
            message:
              type: string
              example: Location 123 was not found for the provided tenant
            requestId:
              type: string
              format: uuid
  responses:
    Unauthorized:
      description: Token Bearer mancante, non valido o scaduto
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            unauthorized:
              value:
                error:
                  code: UNAUTHORIZED
                  message: Invalid or expired token
                  requestId: b1f6e6b0-1234-4abc-9def-000000000000
    FeatureNotEnabled:
      description: Il tenant non ha l'Energy Management API abilitata
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            featureNotEnabled:
              value:
                error:
                  code: FEATURE_NOT_ENABLED
                  message: >-
                    The Energy Management API is not enabled for your account.
                    Contact RiDERgy to enable this feature.
                  requestId: b1f6e6b0-1234-4abc-9def-000000000000
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >
        Access token OAuth 2.0 ottenuto tramite `POST /oauth/token` con grant
        client_credentials.

        Tenant e scopes sono incorporati nel JWT. Non sono necessari header
        aggiuntivi.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.