---
title: "Create subject"
method: POST
path: "/subjects"
tags: ["subjects"]
---

# Create subject

`POST /subjects`

Create a new subject. If you are creating a new subject as the child of another subject AND any of its ancestors has isPublished=false, then you must create your new subject with isPublished=false.

## Request body

- object — A resource under observation.
  - `description` string — A description of the subject. A lens may choose to display this information to the user.
  - `helpEmail` string — The email address where a user can go to get more help about the subject. A lens may choose to display this information to the user e.g. if the user clicks a “help” icon attached to the subject.
  - `helpUrl` string — The url where a user can go to get more help about the subject. A lens may choose to display this information to the user e.g. if the user clicks a “help” icon attached to the subject.
  - `imageUrl` string — Optional icon to represent the subject.
  - `isPublished` boolean — Default false. When set to true, the subject is readable by other users; when set to false, the subject is only readable by its owner. You can only unpublish a subject if it has no subject children of its own or if all its descendants are unpublished.
  - `name` string, required — Max 60 characters; case insensitive; allows alpha-numeric characters, underscore (_) and dash (-).
  - `sortBy` string — The sortBy string can be used to define the sort order of subjects which a lens developer can choose to honor when rendering the data. The attribute is defaulted to an empty string when the user does not provide any string value. Max 254 characters; case insensitive; allows alpha-numeric characters, + underscore (_) and dash (-). Filter by sortBy; asterisk (*) wildcards ok. Max 254 characters; case insensitive; allows alpha-numeric characters, underscore (_) and dash (-).
  - `parentId` string — The id of the subject's parent.
  - `tags` string[] — Array of tag names. Tag name: Max 60 characters; case insensitive; allows alpha-numeric characters, underscore (_) and dash (-). Tag names cannot start with a dash (-).
  - `relatedLinks` RelatedLinkRequest[] — RelatedLinks associated with this model.
    - `name` string, required — Name of the related link.
    - `url` string, required — The relatedLink url. For example, a related link associated with a sample can have a link to the source from which that sample information is obtained.
  - `geolocation` number[] — If the subject has a physical location, specify its longitude and latitude in this two-element array, e.g. [-122.431297, 37.773972]. The first element in the array represents longitude; the second element represents latitude.
  - `owner` string — The name of the user to assign as the owner. Defaults to the user that created it

## Response `201`

Created.

- SubjectsResponse — A resource under observation.
  - `absolutePath` string — The absolute path of the subject. This is automatically set based on the name and hierarchy.
  - `children` SubjectsResponse[]
  - `description` string — A description of the subject. A lens may choose to display this information to the user.
  - `helpEmail` string — The email address where a user can go to get more help about the subject. A lens may choose to display this information to the user e.g. if the user clicks a “help” icon attached to the subject.
  - `helpUrl` string — The url where a user can go to get more help about the subject. A lens may choose to display this information to the user e.g. if the user clicks a “help” icon attached to the subject.
  - `id` string
  - `imageUrl` string — Optional icon to represent the subject.
  - `isPublished` boolean — Default false. When set to true, the subject is readable by other users; when set to false, the subject is only readable by its owner.
  - `name` string — Max 60 characters; case insensitive; allows alpha-numeric characters, underscore (_) and dash (-).
  - `sortBy` string — The sortBy string can be used to define the sort order of subjects which a lens developer can choose to honor when rendering the data. The attribute is defaulted to an empty string when the user does not provide any string value. Max 254 characters; case insensitive; allows alpha-numeric characters, + underscore (_) and dash (-). Filter by sortBy; asterisk (*) wildcards ok. Max 254 characters; case insensitive; allows alpha-numeric characters, underscore (_) and dash (-).
  - `parentId` string — The id of the subject's parent, empty if this subject is at the root of the hierarchy.
  - `parentAbsolutePath` string — The absolute path of the subject's parent, empty if this subject is at the root of the hierarchy.
  - `createdBy` string — Id of the User who created this Aspect.
  - `createdAt` string — TODO
  - `updatedAt` string — TODO
  - `tags` string[] — Array of tag names. Tag name: Max 60 characters; case insensitive; allows alpha-numeric characters, underscore (_) and dash (-). Tag names cannot start with a dash (-).
  - `samples` object[] — TODO
  - `relatedLinks` RelatedLinkResponse[] — RelatedLinks associated with this model.
    - `name` string — Name of the related link.
    - `url` string — The relatedLink url. For example, a related link associated with a sample can have a link to the source from which that sample information is obtained.
  - `apiLinks` HATEOAS[] — Hypertext As The Engine Of Application State.
    - `href` string, required — URL of the related HATEOAS link you can use for subsequent calls.
    - `rel` string, required — Link relation that describes how this link relates to the previous call.
    - `method` string, required — The HTTP method required for the related call.
  - `hierarchyLevel` integer — The depth of the subject starting from the root. The root always has a hierarchy level of 1

## Other responses

- `400` — Bad Request
- `403` — Forbidden
- `default` — Error

---

[API](https://skmtc.net/salesforce/apis/refocus-api.md) · [All operations](https://skmtc.net/salesforce/apis/refocus-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/salesforce/refocus-api/versions/42c2153b047e/schema)
