Skip to main content
PATCH
/
api
/
v1
/
project-templates
/
{templateId}
cURL
curl --request PATCH \
  --url https://us.infisical.com/api/v1/project-templates/{templateId} \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "description": "<string>",
  "roles": [
    {
      "name": "<string>",
      "slug": "<string>",
      "permissions": [
        {
          "subject": "secrets",
          "inverted": true,
          "conditions": {
            "environment": "<string>",
            "secretPath": "<string>",
            "secretName": "<string>",
            "secretTags": {
              "$in": [
                "<string>"
              ],
              "$all": [
                "<string>"
              ]
            },
            "eventType": "<string>"
          }
        }
      ]
    }
  ],
  "environments": [
    {
      "name": "<string>",
      "slug": "<string>",
      "position": 2
    }
  ],
  "users": [
    {
      "username": "<string>",
      "roles": [
        "<string>"
      ]
    }
  ],
  "groups": [
    {
      "groupSlug": "<string>",
      "roles": [
        "<string>"
      ]
    }
  ],
  "identities": [
    {
      "identityId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "roles": [
        "<string>"
      ]
    }
  ],
  "projectManagedIdentities": [
    {
      "name": "<string>",
      "roles": [
        "<string>"
      ]
    }
  ]
}
'
import requests

url = "https://us.infisical.com/api/v1/project-templates/{templateId}"

payload = {
"name": "<string>",
"description": "<string>",
"roles": [
{
"name": "<string>",
"slug": "<string>",
"permissions": [
{
"subject": "secrets",
"inverted": True,
"conditions": {
"environment": "<string>",
"secretPath": "<string>",
"secretName": "<string>",
"secretTags": {
"$in": ["<string>"],
"$all": ["<string>"]
},
"eventType": "<string>"
}
}
]
}
],
"environments": [
{
"name": "<string>",
"slug": "<string>",
"position": 2
}
],
"users": [
{
"username": "<string>",
"roles": ["<string>"]
}
],
"groups": [
{
"groupSlug": "<string>",
"roles": ["<string>"]
}
],
"identities": [
{
"identityId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"roles": ["<string>"]
}
],
"projectManagedIdentities": [
{
"name": "<string>",
"roles": ["<string>"]
}
]
}
headers = {"Content-Type": "application/json"}

response = requests.patch(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PATCH',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
roles: [
{
name: '<string>',
slug: '<string>',
permissions: [
{
subject: 'secrets',
inverted: true,
conditions: {
environment: '<string>',
secretPath: '<string>',
secretName: '<string>',
secretTags: {$in: ['<string>'], $all: ['<string>']},
eventType: '<string>'
}
}
]
}
],
environments: [{name: '<string>', slug: '<string>', position: 2}],
users: [{username: '<string>', roles: ['<string>']}],
groups: [{groupSlug: '<string>', roles: ['<string>']}],
identities: [{identityId: '3c90c3cc-0d44-4b50-8888-8dd25736052a', roles: ['<string>']}],
projectManagedIdentities: [{name: '<string>', roles: ['<string>']}]
})
};

fetch('https://us.infisical.com/api/v1/project-templates/{templateId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://us.infisical.com/api/v1/project-templates/{templateId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '<string>',
'roles' => [
[
'name' => '<string>',
'slug' => '<string>',
'permissions' => [
[
'subject' => 'secrets',
'inverted' => true,
'conditions' => [
'environment' => '<string>',
'secretPath' => '<string>',
'secretName' => '<string>',
'secretTags' => [
'$in' => [
'<string>'
],
'$all' => [
'<string>'
]
],
'eventType' => '<string>'
]
]
]
]
],
'environments' => [
[
'name' => '<string>',
'slug' => '<string>',
'position' => 2
]
],
'users' => [
[
'username' => '<string>',
'roles' => [
'<string>'
]
]
],
'groups' => [
[
'groupSlug' => '<string>',
'roles' => [
'<string>'
]
]
],
'identities' => [
[
'identityId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'roles' => [
'<string>'
]
]
],
'projectManagedIdentities' => [
[
'name' => '<string>',
'roles' => [
'<string>'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://us.infisical.com/api/v1/project-templates/{templateId}"

payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"roles\": [\n {\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"permissions\": [\n {\n \"subject\": \"secrets\",\n \"inverted\": true,\n \"conditions\": {\n \"environment\": \"<string>\",\n \"secretPath\": \"<string>\",\n \"secretName\": \"<string>\",\n \"secretTags\": {\n \"$in\": [\n \"<string>\"\n ],\n \"$all\": [\n \"<string>\"\n ]\n },\n \"eventType\": \"<string>\"\n }\n }\n ]\n }\n ],\n \"environments\": [\n {\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"position\": 2\n }\n ],\n \"users\": [\n {\n \"username\": \"<string>\",\n \"roles\": [\n \"<string>\"\n ]\n }\n ],\n \"groups\": [\n {\n \"groupSlug\": \"<string>\",\n \"roles\": [\n \"<string>\"\n ]\n }\n ],\n \"identities\": [\n {\n \"identityId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"roles\": [\n \"<string>\"\n ]\n }\n ],\n \"projectManagedIdentities\": [\n {\n \"name\": \"<string>\",\n \"roles\": [\n \"<string>\"\n ]\n }\n ]\n}")

req, _ := http.NewRequest("PATCH", url, payload)

req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.patch("https://us.infisical.com/api/v1/project-templates/{templateId}")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"roles\": [\n {\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"permissions\": [\n {\n \"subject\": \"secrets\",\n \"inverted\": true,\n \"conditions\": {\n \"environment\": \"<string>\",\n \"secretPath\": \"<string>\",\n \"secretName\": \"<string>\",\n \"secretTags\": {\n \"$in\": [\n \"<string>\"\n ],\n \"$all\": [\n \"<string>\"\n ]\n },\n \"eventType\": \"<string>\"\n }\n }\n ]\n }\n ],\n \"environments\": [\n {\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"position\": 2\n }\n ],\n \"users\": [\n {\n \"username\": \"<string>\",\n \"roles\": [\n \"<string>\"\n ]\n }\n ],\n \"groups\": [\n {\n \"groupSlug\": \"<string>\",\n \"roles\": [\n \"<string>\"\n ]\n }\n ],\n \"identities\": [\n {\n \"identityId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"roles\": [\n \"<string>\"\n ]\n }\n ],\n \"projectManagedIdentities\": [\n {\n \"name\": \"<string>\",\n \"roles\": [\n \"<string>\"\n ]\n }\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://us.infisical.com/api/v1/project-templates/{templateId}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"roles\": [\n {\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"permissions\": [\n {\n \"subject\": \"secrets\",\n \"inverted\": true,\n \"conditions\": {\n \"environment\": \"<string>\",\n \"secretPath\": \"<string>\",\n \"secretName\": \"<string>\",\n \"secretTags\": {\n \"$in\": [\n \"<string>\"\n ],\n \"$all\": [\n \"<string>\"\n ]\n },\n \"eventType\": \"<string>\"\n }\n }\n ]\n }\n ],\n \"environments\": [\n {\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"position\": 2\n }\n ],\n \"users\": [\n {\n \"username\": \"<string>\",\n \"roles\": [\n \"<string>\"\n ]\n }\n ],\n \"groups\": [\n {\n \"groupSlug\": \"<string>\",\n \"roles\": [\n \"<string>\"\n ]\n }\n ],\n \"identities\": [\n {\n \"identityId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"roles\": [\n \"<string>\"\n ]\n }\n ],\n \"projectManagedIdentities\": [\n {\n \"name\": \"<string>\",\n \"roles\": [\n \"<string>\"\n ]\n }\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "projectTemplate": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "name": "<string>",
    "roles": [
      {
        "name": "<string>",
        "slug": "<string>",
        "permissions": [
          {
            "action": "<string>",
            "subject": "<string>",
            "conditions": "<unknown>",
            "inverted": true
          }
        ]
      }
    ],
    "environments": [
      {
        "name": "<string>",
        "slug": "<string>",
        "position": 2
      }
    ],
    "orgId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "createdAt": "2023-11-07T05:31:56Z",
    "updatedAt": "2023-11-07T05:31:56Z",
    "projectManagedIdentities": [
      {
        "name": "<string>",
        "roles": [
          "<string>"
        ]
      }
    ],
    "users": [
      {
        "username": "<string>",
        "roles": [
          "<string>"
        ]
      }
    ],
    "groups": [
      {
        "groupSlug": "<string>",
        "roles": [
          "<string>"
        ]
      }
    ],
    "identities": [
      {
        "identityId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "identityName": "<string>",
        "roles": [
          "<string>"
        ]
      }
    ],
    "description": "<string>",
    "type": "secret-manager"
  }
}
{
"reqId": "<string>",
"statusCode": 400,
"message": "<string>",
"error": "<string>",
"details": "<unknown>"
}
{
"reqId": "<string>",
"statusCode": 401,
"message": "<string>",
"error": "<string>"
}
{
"reqId": "<string>",
"statusCode": 403,
"message": "<string>",
"error": "<string>",
"details": "<unknown>"
}
{
"reqId": "<string>",
"statusCode": 404,
"message": "<string>",
"error": "<string>"
}
{
"reqId": "<string>",
"statusCode": 422,
"error": "<string>",
"message": "<unknown>"
}
{
"reqId": "<string>",
"statusCode": 500,
"message": "<string>",
"error": "<string>"
}
You can read more about the role’s permissions field in the permissions documentation.

Path Parameters

templateId
string<uuid>
required

The ID of the project template to be updated.

Body

application/json
name
string

The updated name of the project template. Must be slug-friendly.

Required string length: 1 - 64
description
string

The updated description of the project template.

Maximum string length: 256
roles
object[]

The updated roles to be created when the template is applied to a project.

environments
object[] | null

The updated environments to be created when the template is applied to a project.

users
object[] | null

The updated users to be automatically added to projects created from this template. Each user is identified by username and assigned one or more roles.

groups
object[] | null

The updated groups to be automatically added to projects created from this template. Each group is identified by slug and assigned one or more roles.

identities
object[] | null

The updated organization-owned identities to be automatically added to projects created from this template. Each identity is identified by ID and assigned one or more roles.

projectManagedIdentities
object[] | null

The updated project-owned identities to be automatically created for projects created from this template. Each identity is identified by name and assigned one or more roles.

Response

Default Response

projectTemplate
object
required