---
title: "Create Or Update Resource (saveResource)"
method: POST
path: "/api/resource"
tags: ["tb-resource-controller"]
deprecated: true
---

# Create Or Update Resource (saveResource)

`POST /api/resource`

> **Deprecated.**

Create or update the Resource. When creating the Resource, platform generates Resource id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Resource id will be present in the response. Specify existing Resource id to update the Resource. Referencing non-existing Resource Id will cause 'Not Found' error. 

Resource combination of the title with the key is unique in the scope of tenant. Remove 'id', 'tenantId' from the request body example (below) to create new Resource entity.

Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority.

## Request body

- TbResource — A JSON value representing the Resource.
  - `id` TbResourceId
    - `id` string, uuid, required — ID of the entity, time-based UUID v1
    - `entityType` 'TB_RESOURCE', required — string
  - `createdTime` integer — Timestamp of the resource creation, in milliseconds
  - `tenantId` TenantId
    - `id` string, uuid, required — ID of the entity, time-based UUID v1
    - `entityType` 'TENANT', required — string
  - `title` string — Resource title.
  - `resourceType` 'LWM2M_MODEL' | 'JKS' | 'PKCS_12' | 'JS_MODULE' | 'IMAGE' | 'DASHBOARD' | 'GENERAL' — Resource type.
  - `resourceSubType` 'IMAGE' | 'SCADA_SYMBOL' | 'EXTENSION' | 'MODULE' — Resource sub type.
  - `resourceKey` string — Resource key.
  - `publicResourceKey` string
  - `etag` string — Resource etag.
  - `fileName` string — Resource file name.
  - `descriptor` unknown
  - `data` string — Resource data.
  - `preview` string
  - `name` string
  - `public` boolean
  - `link` string
  - `publicLink` string

## Response `200`

OK

- TbResourceInfo — A JSON value representing the Resource Info.
  - `id` TbResourceId
    - `id` string, uuid, required — ID of the entity, time-based UUID v1
    - `entityType` 'TB_RESOURCE', required — string
  - `createdTime` integer — Timestamp of the resource creation, in milliseconds
  - `tenantId` TenantId
    - `id` string, uuid, required — ID of the entity, time-based UUID v1
    - `entityType` 'TENANT', required — string
  - `title` string — Resource title.
  - `resourceType` 'LWM2M_MODEL' | 'JKS' | 'PKCS_12' | 'JS_MODULE' | 'IMAGE' | 'DASHBOARD' | 'GENERAL' — Resource type.
  - `resourceSubType` 'IMAGE' | 'SCADA_SYMBOL' | 'EXTENSION' | 'MODULE' — Resource sub type.
  - `resourceKey` string — Resource key.
  - `publicResourceKey` string
  - `etag` string — Resource etag.
  - `fileName` string — Resource file name.
  - `descriptor` unknown
  - `name` string
  - `public` boolean
  - `link` string
  - `publicLink` string

---

[API](https://skmtc.net/thingsboard/apis/thingsboard-rest-api.md) · [All operations](https://skmtc.net/thingsboard/apis/thingsboard-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/thingsboard/thingsboard-rest-api/revisions/40169ccdec5c/schema)
