Skip to main content
POST
/
resources
Creates a resource
curl --request POST \
  --url https://use.hoop.dev/api/resources \
  --header 'Content-Type: */*' \
  --data '
{
  "env_vars": {},
  "name": "my-resource",
  "type": "database",
  "agent_id": "1837453e-01fc-46f3-9e4c-dcf22d395393",
  "roles": [
    {
      "name": "pgdemo",
      "type": "database",
      "agent_id": "1837453e-01fc-46f3-9e4c-dcf22d395393",
      "command": [
        "/bin/bash"
      ],
      "secret": {},
      "subtype": "postgres"
    }
  ],
  "subtype": "mysql"
}
'
{
  "agent_id": "1837453e-01fc-46f3-9e4c-dcf22d395393",
  "created_at": "2024-07-25T15:56:35.317601Z",
  "env_vars": {},
  "id": "15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D7",
  "name": "my-resource",
  "roles": [
    {
      "agent_id": "1837453e-01fc-46f3-9e4c-dcf22d395393",
      "name": "pgdemo",
      "type": "database",
      "access_max_duration": 3600,
      "attributes": [
        "production",
        "pii"
      ],
      "command": [
        "/bin/bash"
      ],
      "connection_tags": {
        "environment": "prod",
        "tier": "frontend"
      },
      "default_database": "<string>",
      "force_approve_groups": [
        "sre-team"
      ],
      "guardrail_rules": [
        "5701046A-7B7A-4A78-ABB0-A24C95E6FE54",
        "B19BBA55-8646-4D94-A40A-C3AFE2F4BAFD"
      ],
      "id": "5364ec99-653b-41ba-8165-67236e894990",
      "jira_issue_template_id": "B19BBA55-8646-4D94-A40A-C3AFE2F4BAFD",
      "jit_access_duration_sec": 1800,
      "managed_by": "",
      "mandatory_metadata_fields": [
        "environment",
        "tier"
      ],
      "min_review_approvals": 2,
      "redact_enabled": true,
      "redact_types": [
        "EMAIL_ADDRESS"
      ],
      "resource_name": "pgdemo",
      "reviewers": [
        "dba-group"
      ],
      "secret": {},
      "subtype": "postgres",
      "tags": [
        "prod"
      ]
    }
  ],
  "subtype": "mysql",
  "type": "database",
  "updated_at": "2024-07-25T15:56:35.317601Z"
}

Body

*/*

The request body resource

env_vars
object
required

The resource environment variables

name
string
required

The resource name

Example:

"my-resource"

type
string
required

The resource type

Example:

"database"

agent_id
string<uuid>

The agent associated with this resource

Example:

"1837453e-01fc-46f3-9e4c-dcf22d395393"

roles
object[]

The roles associated with this resource

subtype
string

The resource subtype (optional; defaults to the value of 'type' when omitted)

Example:

"mysql"

Response

Created

agent_id
string<uuid>
required

The agent associated with this resource

Example:

"1837453e-01fc-46f3-9e4c-dcf22d395393"

created_at
string
read-only

The time the resource was created

Example:

"2024-07-25T15:56:35.317601Z"

env_vars
object

The resource environment variables

id
string<uuid>
read-only

The resource ID

Example:

"15B5A2FD-0706-4A47-B1CF-B93CCFC5B3D7"

name
string

The resource name

Example:

"my-resource"

roles
object[]

Connections (roles) associated with this resource

subtype
string

The resource subtype

Example:

"mysql"

type
string

The resource type

Example:

"database"

updated_at
string
read-only

The time the resource was updated

Example:

"2024-07-25T15:56:35.317601Z"