---
title: "Create Resource"
method: POST
path: "/v2/schema/{proj_id}/{env_id}/resources"
tags: ["Resources"]
---

# Create Resource

`POST /v2/schema/{proj_id}/{env_id}/resources`

Creates a new resource (a type of object you may protect with permissions).

## Path parameters

- `proj_id` string, required — Either the unique id of the project, or the URL-friendly key of the project (i.e: the "slug").
- `env_id` string, required — Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the "slug").

## Request body

- ResourceCreate
  - `key` string, required — A URL-friendly name of the resource (i.e: slug). You will be able to query later using this key instead of the id (UUID) of the resource.
  - `name` string, required — The name of the resource
  - `urn` string — The [URN](https://en.wikipedia.org/wiki/Uniform_Resource_Name) (Uniform Resource Name) of the resource
  - `description` string — An optional longer description of what this resource respresents in your system
  - `actions` object, required — A actions definition block, typically contained within a resource type definition block. The actions represents the ways you can interact with a protected resource.
  - `type_attributes` object — optional dictionary of key-value pairs that can be used to store arbitrary metadata about this resource. This metadata can be used to filter resource using query parameters with attr_ prefix
  - `attributes` object — Attributes that each resource of this type defines, and can be used in your ABAC policies.
  - `roles` object — Roles defined on this resource. The key is the role name, and the value contains the role properties such as granted permissions, base roles, etc.
  - `relations` object — Relations to other resources. The key is the relation key, and the value is the related resource.
  - `v1compat_path` string
  - `v1compat_type` string
  - `v1compat_name` string

## Response `200`

Successful Response

- ResourceRead
  - `key` string, required — A URL-friendly name of the resource (i.e: slug). You will be able to query later using this key instead of the id (UUID) of the resource.
  - `id` string, uuid, required — Unique id of the resource
  - `organization_id` string, uuid, required — Unique id of the organization that the resource belongs to.
  - `project_id` string, uuid, required — Unique id of the project that the resource belongs to.
  - `environment_id` string, uuid, required — Unique id of the environment that the resource belongs to.
  - `created_at` string, date-time, required — Date and time when the resource was created (ISO_8601 format).
  - `updated_at` string, date-time, required — Date and time when the resource was last updated/modified (ISO_8601 format).
  - `name` string, required — The name of the resource
  - `urn` string — The [URN](https://en.wikipedia.org/wiki/Uniform_Resource_Name) (Uniform Resource Name) of the resource
  - `description` string — An optional longer description of what this resource respresents in your system
  - `actions` object — A actions definition block, typically contained within a resource type definition block. The actions represents the ways you can interact with a protected resource.
  - `type_attributes` object — optional dictionary of key-value pairs that can be used to store arbitrary metadata about this resource. This metadata can be used to filter resource using query parameters with attr_ prefix
  - `attributes` object — Attributes that each resource of this type defines, and can be used in your ABAC policies.
  - `roles` object — Roles defined on this resource. The key is the role name, and the value contains the role properties such as granted permissions, etc.
  - `relations` object — A relations definition block, typically contained within a resource type definition block. The relations represents the ways you can interact with a protected resource.
  - `v1compat_path` string
  - `v1compat_type` string
  - `v1compat_name` string
  - `action_groups` object

## Other responses

- `422` — Validation Error

---

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