Skip to main content
POST
/
api
/
v1
/
project-templates
cURL
curl --request POST \
  --url https://us.infisical.com/api/v1/project-templates \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "description": "<string>",
  "roles": [],
  "environments": [
    {
      "name": "<string>",
      "slug": "<string>",
      "position": 2
    }
  ],
  "users": [],
  "groups": [],
  "identities": [],
  "projectManagedIdentities": []
}
'
import requests

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

payload = {
"name": "<string>",
"description": "<string>",
"roles": [],
"environments": [
{
"name": "<string>",
"slug": "<string>",
"position": 2
}
],
"users": [],
"groups": [],
"identities": [],
"projectManagedIdentities": []
}
headers = {"Content-Type": "application/json"}

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

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
roles: [],
environments: [{name: '<string>', slug: '<string>', position: 2}],
users: [],
groups: [],
identities: [],
projectManagedIdentities: []
})
};

fetch('https://us.infisical.com/api/v1/project-templates', 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",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '<string>',
'roles' => [

],
'environments' => [
[
'name' => '<string>',
'slug' => '<string>',
'position' => 2
]
],
'users' => [

],
'groups' => [

],
'identities' => [

],
'projectManagedIdentities' => [

]
]),
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"

payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"roles\": [],\n \"environments\": [\n {\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"position\": 2\n }\n ],\n \"users\": [],\n \"groups\": [],\n \"identities\": [],\n \"projectManagedIdentities\": []\n}")

req, _ := http.NewRequest("POST", 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.post("https://us.infisical.com/api/v1/project-templates")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"roles\": [],\n \"environments\": [\n {\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"position\": 2\n }\n ],\n \"users\": [],\n \"groups\": [],\n \"identities\": [],\n \"projectManagedIdentities\": []\n}")
.asString();
require 'uri'
require 'net/http'

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

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

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"roles\": [],\n \"environments\": [\n {\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"position\": 2\n }\n ],\n \"users\": [],\n \"groups\": [],\n \"identities\": [],\n \"projectManagedIdentities\": []\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.

Body

application/json
name
string
required

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

Required string length: 1 - 64
type
enum<string>
required

The type of project template to be created.

Available options:
secret-manager,
cert-manager,
kms,
ssh,
secret-scanning,
pam,
ai
description
string

An optional description of the project template.

Maximum string length: 256
roles
object[]

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

environments
object[] | null

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

users
object[]

The 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[]

The 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[]

The 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[]

The 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