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

# Add to library

> # Description

Add a survey item to the library.

# Payload

```json
{
    "item": {
        "type": "string",
        "subtype": "string",
        "frontendId": number,
        "position": number,
        "title": "string",
        "config": object
    },
    "name": "string",
    "isShared": boolean,
    "isDefaultItem": boolean
}
```

- `item`: Object containing the item configuration
  - `type`: Item type. **Required**.
  - `subtype`: Item subtype. **Required**.
  - `frontendId`: Item frontend id. **Required**.
  - `position`: Item position in the survey. **Required**.
  - `title`: Item title. **Required**.
  - `config`: Object containing item configurations, internal fields depend on the item type. Refer to the auto save functionality for further details.. **Required**.
- `name`: Item name for library. Optional.
- `isShared`: Boolean value to know if the item is shared with other company members. Optional.
- `isDefaultItem`: Boolean value to know if the item is default. **Required**.

# Response

## 200 OK

```json
{
    "createdAt": "string",
    "updatedAt": "string",
    "name": "string",
    "isDefaultItem": boolean,
    "isShared": boolean,
    "item": {
        "type": "string",
        "subtype": "string",
        "frontendId": number,
        "position": number,
        "title": "string",
        "config": object
    },
    "id": "string"
}
```

where:

- `createdAt`: Creation date for the library item with the format `YYYY-MM-DDTHH:mm:ss.SSSZ`.
- `updatedAt`: Last update date for the library item with the format `YYYY-MM-DDTHH:mm:ss.SSSZ`.
- `name`: Library item name.
- `isDefaultItem`: Whether or not the item should be available for all users.
- `isShared`: Whether or not the item is shared for all users in the same company as the user that created it.
- `item`: Same item passed in the payload.
- `id`: Library item identifier.

## 400 Bad Request

> `subtype` / `frontendId` / `position` / `title` / `config` are missing from item.

## 401 Unauthorized

> The user doesn't have permissions.

## 422 Unprocessable Entity

> `type` is missing from item.

> `isDefaultItem` is missing.

## 500 Internal Server Error

> Error occurred while processing the request.

# Description

Add a survey item to the library.

# Payload

```json theme={null}
{
    "item": {
        "type": "string",
        "subtype": "string",
        "frontendId": number,
        "position": number,
        "title": "string",
        "config": object
    },
    "name": "string",
    "isShared": boolean,
    "isDefaultItem": boolean
}
```

* `item`: Object containing the item configuration
  * `type`: Item type. **Required**.
  * `subtype`: Item subtype. **Required**.
  * `frontendId`: Item frontend id. **Required**.
  * `position`: Item position in the survey. **Required**.
  * `title`: Item title. **Required**.
  * `config`: Object containing item configurations, internal fields depend on the item type. Refer to the auto save functionality for further details.. **Required**.
* `name`: Item name for library. Optional.
* `isShared`: Boolean value to know if the item is shared with other company members. Optional.
* `isDefaultItem`: Boolean value to know if the item is default. **Required**.

# Response

## 200 OK

```json theme={null}
{
    "createdAt": "string",
    "updatedAt": "string",
    "name": "string",
    "isDefaultItem": boolean,
    "isShared": boolean,
    "item": {
        "type": "string",
        "subtype": "string",
        "frontendId": number,
        "position": number,
        "title": "string",
        "config": object
    },
    "id": "string"
}
```

where:

* `createdAt`: Creation date for the library item with the format `YYYY-MM-DDTHH:mm:ss.SSSZ`.
* `updatedAt`: Last update date for the library item with the format `YYYY-MM-DDTHH:mm:ss.SSSZ`.
* `name`: Library item name.
* `isDefaultItem`: Whether or not the item should be available for all users.
* `isShared`: Whether or not the item is shared for all users in the same company as the user that created it.
* `item`: Same item passed in the payload.
* `id`: Library item identifier.

## 400 Bad Request

> `subtype` / `frontendId` / `position` / `title` / `config` are missing from item.

## 401 Unauthorized

> The user doesn't have permissions.

## 422 Unprocessable Entity

> `type` is missing from item.

> `isDefaultItem` is missing.

## 500 Internal Server Error

> Error occurred while processing the request.


## OpenAPI

````yaml POST /projects-api/v1/questionsLibrary
openapi: 3.0.3
info:
  title: SightX API
  version: 1.0.0
  description: >-
    SightX REST API documentation. Most responses are JSON; some export
    endpoints return files. API access is a paid add-on — contact
    sales@sightx.io for details.
servers:
  - url: https://auth.admin.sightx.io
    description: Authentication (Production)
  - url: https://auth.staging-admin.sightx.io
    description: Authentication (Staging)
security:
  - AuthorizationHeader: []
paths:
  /projects-api/v1/questionsLibrary:
    post:
      summary: Add to library
      description: >-
        # Description


        Add a survey item to the library.


        # Payload


        ```json

        {
            "item": {
                "type": "string",
                "subtype": "string",
                "frontendId": number,
                "position": number,
                "title": "string",
                "config": object
            },
            "name": "string",
            "isShared": boolean,
            "isDefaultItem": boolean
        }

        ```


        - `item`: Object containing the item configuration
          - `type`: Item type. **Required**.
          - `subtype`: Item subtype. **Required**.
          - `frontendId`: Item frontend id. **Required**.
          - `position`: Item position in the survey. **Required**.
          - `title`: Item title. **Required**.
          - `config`: Object containing item configurations, internal fields depend on the item type. Refer to the auto save functionality for further details.. **Required**.
        - `name`: Item name for library. Optional.

        - `isShared`: Boolean value to know if the item is shared with other
        company members. Optional.

        - `isDefaultItem`: Boolean value to know if the item is default.
        **Required**.


        # Response


        ## 200 OK


        ```json

        {
            "createdAt": "string",
            "updatedAt": "string",
            "name": "string",
            "isDefaultItem": boolean,
            "isShared": boolean,
            "item": {
                "type": "string",
                "subtype": "string",
                "frontendId": number,
                "position": number,
                "title": "string",
                "config": object
            },
            "id": "string"
        }

        ```


        where:


        - `createdAt`: Creation date for the library item with the format
        `YYYY-MM-DDTHH:mm:ss.SSSZ`.

        - `updatedAt`: Last update date for the library item with the format
        `YYYY-MM-DDTHH:mm:ss.SSSZ`.

        - `name`: Library item name.

        - `isDefaultItem`: Whether or not the item should be available for all
        users.

        - `isShared`: Whether or not the item is shared for all users in the
        same company as the user that created it.

        - `item`: Same item passed in the payload.

        - `id`: Library item identifier.


        ## 400 Bad Request


        > `subtype` / `frontendId` / `position` / `title` / `config` are missing
        from item.


        ## 401 Unauthorized


        > The user doesn't have permissions.


        ## 422 Unprocessable Entity


        > `type` is missing from item.


        > `isDefaultItem` is missing.


        ## 500 Internal Server Error


        > Error occurred while processing the request.
      operationId: add-to-library-post-projects-api-v1-questionslibrary
      parameters:
        - name: Authorization
          in: header
          required: true
          description: Authorization token
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
      responses:
        '200':
          description: Add to library
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
              example:
                createdAt: '2021-09-20T22:14:23.190Z'
                updatedAt: '2021-09-20T22:14:23.190Z'
                name: Name on library
                isDefaultItem: false
                isShared: false
                item:
                  type: input
                  subtype: text
                  frontendId: 1630426103641
                  position: 1
                  title: <p>Question title</p>
                  config:
                    maxLength: 250
                    isRequired: true
                    allowNA: false
                id: 614907bfec80380d3543de9b
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '500':
          description: Internal server error
      servers:
        - url: https://project.sightx.io
components:
  securitySchemes:
    AuthorizationHeader:
      type: apiKey
      in: header
      name: Authorization
      description: Access token obtained from the m2m-token endpoint.

````