---
title: "Create library element."
method: POST
path: "/library-elements"
tags: ["library_elements"]
---

# Create library element.

`POST /library-elements`

## Request

- Base URL: `/api` (relative, and the document’s source URL is not known)
- URL: `/api/library-elements`
- Auth: one of:
  - HTTP basic
  - API key in header `Authorization`

Creates a new library element.

## Request body

- CreateLibraryElementCommand: CreateLibraryElementCommand is the command for adding a LibraryElement
  - `folderId` integer: ID of the folder where the library element is stored. Deprecated: use FolderUID instead
  - `folderUid` string: UID of the folder where the library element is stored.
  - `kind` 1: Kind of element to create, Use 1 for library panels or 2 for c. Description: 1 - library panels
  - `model` object: The JSON model for the library element.
  - `name` string: Name of the library element.
  - `uid` string

## Response `200`

(empty)

- LibraryElementResponse
  - `result` LibraryElementDTO
    - `description` string
    - `folderId` integer: Deprecated: use FolderUID instead
    - `folderUid` string
    - `id` integer
    - `kind` integer
    - `meta` LibraryElementDTOMeta
      - `connectedDashboards` integer
      - `created` string, date-time
      - `createdBy` LibraryElementDTOMetaUser
        - `avatarUrl` string
        - `id` integer
        - `name` string
      - `folderName` string
      - `folderUid` string
      - `updated` string, date-time
      - `updatedBy` LibraryElementDTOMetaUser
        - `avatarUrl` string
        - `id` integer
        - `name` string
    - `model` object
    - `name` string
    - `orgId` integer
    - `schemaVersion` integer
    - `type` string
    - `uid` string
    - `version` integer

## Other responses

- `400`: BadRequestError is returned when the request is invalid and it cannot be processed.
- `401`: UnauthorizedError is returned when the request is not authenticated.
- `403`: ForbiddenError is returned if the user/token has insufficient permissions to access the requested resource.
- `404`: NotFoundError is returned when the requested resource was not found.
- `500`: InternalServerError is a general error indicating something went wrong internally.

---

[API](https://skmtc.dev/grafana/apis/grafana-http-api.md) - [All operations](https://skmtc.dev/grafana/apis/grafana-http-api/llms.txt) - [OpenAPI document](https://skmtc.dev/grafana/apis/grafana-http-api/revisions/df55ba1718ba?raw)
