---
title: "Create or Update collection"
url: "https://nov18-dev.movespot.fyi/apis/internal-documenthub-admin-api-v2-0/versions/de89c41a-3213-4ea1-ba03-774a702c2f4a/operations/putCollection"
---

> Full API specification: https://nov18-dev.movespot.fyi/apis/internal-documenthub-admin-api-v2-0/versions/de89c41a-3213-4ea1-ba03-774a702c2f4a.md

# Create or Update collection

`PUT` `/collections/{collectionId}`

Operation ID: `putCollection`

Create or Update the document collection. collectionId must be globally unique. A collectionId of a different kind (service/portal) must not already exist.

## Path parameters

- `collectionId` (string, uuid, required) - Targeted collection

## Request body

Content types: `application/json`

## Responses

- `200` - The document collection has been updated
- `201` - The document collection has been created
- `409` - Conflict

## OpenAPI definition

```yaml
openapi: 3.0.3
info:
  title: Internal DocumentHub admin Api v2
  version: 0.0.2
servers:
  - url: http://documenthub.documenthub.svc.cluster.local:4400/v2
    description: Konnect cluster
paths:
  /collections/{collectionId}:
    parameters:
      - $ref: "#/components/parameters/collectionId"
    put:
      operationId: putCollection
      summary: Create or Update collection
      description: Create or Update the document collection. collectionId must be
        globally unique. A collectionId of a different kind (service/portal)
        must not already exist.
      requestBody:
        $ref: "#/components/requestBodies/PutCollection"
      responses:
        "200":
          description: The document collection has been updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DocumentCollection"
        "201":
          description: The document collection has been created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DocumentCollection"
        "409":
          $ref: "#/components/responses/Conflict"
      tags:
        - Collections
security:
  - konnectAccessToken: []
components:
  parameters:
    collectionId:
      name: collectionId
      in: path
      required: true
      description: Targeted collection
      example: bb84c46a-432d-4314-81e4-478614a52dcb
      schema:
        type: string
        format: uuid
  requestBodies:
    PutCollection:
      description: collection put
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/DocumentCollection"
  schemas:
    DocumentCollection:
      description: a document collection
      type: object
      properties:
        id:
          $ref: "#/components/schemas/UUID"
        name:
          type: string
          example: my document collection
        created_at:
          $ref: "#/components/schemas/CreatedAt"
        updated_at:
          $ref: "#/components/schemas/UpdatedAt"
      required:
        - id
        - name
        - created_at
        - updated_at
      title: Document Collection
    UUID:
      description: Contains a unique identifier used for this resource.
      type: string
      format: uuid
      example: 5f9fd312-a987-4628-b4c5-bb4f4fddd5f7
      readOnly: true
    CreatedAt:
      description: An ISO-8601 timestamp representation of entity creation date.
      type: string
      format: date-time
      example: 2022-11-04T20:10:06.927Z
      readOnly: true
    UpdatedAt:
      description: An ISO-8601 timestamp representation of entity update date.
      type: string
      format: date-time
      example: 2022-11-04T20:10:06.927Z
      readOnly: true
    ConflictError:
      allOf:
        - $ref: "#/components/schemas/BaseError"
        - type: object
          properties:
            status:
              example: 409
            title:
              example: Conflict
            type:
              example: https://httpstatuses.com/409
            instance:
              example: kong:trace:1234567890
            detail:
              example: Conflict
    BaseError:
      description: standard error
      type: object
      properties:
        status:
          description: >
            The HTTP status code of the error. Useful when passing the response

            body to child properties in a frontend UI. Must be returned as an
            integer.
          type: integer
          readOnly: true
        title:
          description: |
            A short, human-readable summary of the problem. It should not
            change between occurences of a problem, except for localization.
            Should be provided as "Sentence case" for direct use in the UI.
          type: string
          readOnly: true
        type:
          description: The error type.
          type: string
          readOnly: true
        instance:
          description: |
            Used to return the correlation ID back to the user, in the format
            kong:trace:<correlation_id>. This helps us find the relevant logs
            when a customer reports an issue.
          type: string
          readOnly: true
        detail:
          description: >
            A human readable explanation specific to this occurence of the
            problem.

            This field may contain request/entity data to help the user
            understand

            what went wrong. Enclose variable values in square brackets. Should
            be

            provided as "Sentence case" for direct use in the UI.
          type: string
          readOnly: true
      required:
        - status
        - title
        - instance
        - detail
      title: Error
  responses:
    Conflict:
      description: Conflict
      content:
        application/problem+json:
          schema:
            $ref: "#/components/schemas/ConflictError"
  securitySchemes:
    konnectAccessToken:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >
        The Konnect access token is meant to be used by the Konnect dashboard
        and the decK CLI authenticate with.
```
