Create or update policy
curl --request PUT \
--url https://app.kosli.com/api/v2/policies/{org} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form 'payload={
"name": "<string>",
"description": "",
"type": "env",
"comment": ""
}' \
--form 'policy_file=<string>'import requests
url = "https://app.kosli.com/api/v2/policies/{org}"
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"payload\"\r\n\r\n{\r\n \"name\": \"<string>\",\r\n \"description\": \"\",\r\n \"type\": \"env\",\r\n \"comment\": \"\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"policy_file\"\r\n\r\n<string>\r\n-----011000010111000001101001--"
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "multipart/form-data"
}
response = requests.put(url, data=payload, headers=headers)
print(response.text)const form = new FormData();
form.append('payload', '{
"name": "<string>",
"description": "",
"type": "env",
"comment": ""
}');
form.append('policy_file', '<string>');
const options = {method: 'PUT', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://app.kosli.com/api/v2/policies/{org}', 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://app.kosli.com/api/v2/policies/{org}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"payload\"\r\n\r\n{\r\n \"name\": \"<string>\",\r\n \"description\": \"\",\r\n \"type\": \"env\",\r\n \"comment\": \"\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"policy_file\"\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$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://app.kosli.com/api/v2/policies/{org}"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"payload\"\r\n\r\n{\r\n \"name\": \"<string>\",\r\n \"description\": \"\",\r\n \"type\": \"env\",\r\n \"comment\": \"\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"policy_file\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://app.kosli.com/api/v2/policies/{org}")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"payload\"\r\n\r\n{\r\n \"name\": \"<string>\",\r\n \"description\": \"\",\r\n \"type\": \"env\",\r\n \"comment\": \"\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"policy_file\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.kosli.com/api/v2/policies/{org}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"payload\"\r\n\r\n{\r\n \"name\": \"<string>\",\r\n \"description\": \"\",\r\n \"type\": \"env\",\r\n \"comment\": \"\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"policy_file\"\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"name": "<string>",
"description": "<string>",
"created_by": "<string>",
"created_at": 123,
"last_modified_at": 123,
"archived": false,
"versions": [],
"events": [],
"consuming_envs": []
}{
"name": "<string>",
"description": "<string>",
"created_by": "<string>",
"created_at": 123,
"last_modified_at": 123,
"archived": false,
"versions": [],
"events": [],
"consuming_envs": []
}{
"message": "<string>",
"errors": {}
}{
"message": "<string>",
"errors": {}
}Create or update policy
Create or update a Policy in an organization.
PUT
/
policies
/
{org}
Create or update policy
curl --request PUT \
--url https://app.kosli.com/api/v2/policies/{org} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form 'payload={
"name": "<string>",
"description": "",
"type": "env",
"comment": ""
}' \
--form 'policy_file=<string>'import requests
url = "https://app.kosli.com/api/v2/policies/{org}"
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"payload\"\r\n\r\n{\r\n \"name\": \"<string>\",\r\n \"description\": \"\",\r\n \"type\": \"env\",\r\n \"comment\": \"\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"policy_file\"\r\n\r\n<string>\r\n-----011000010111000001101001--"
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "multipart/form-data"
}
response = requests.put(url, data=payload, headers=headers)
print(response.text)const form = new FormData();
form.append('payload', '{
"name": "<string>",
"description": "",
"type": "env",
"comment": ""
}');
form.append('policy_file', '<string>');
const options = {method: 'PUT', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://app.kosli.com/api/v2/policies/{org}', 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://app.kosli.com/api/v2/policies/{org}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"payload\"\r\n\r\n{\r\n \"name\": \"<string>\",\r\n \"description\": \"\",\r\n \"type\": \"env\",\r\n \"comment\": \"\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"policy_file\"\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$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://app.kosli.com/api/v2/policies/{org}"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"payload\"\r\n\r\n{\r\n \"name\": \"<string>\",\r\n \"description\": \"\",\r\n \"type\": \"env\",\r\n \"comment\": \"\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"policy_file\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://app.kosli.com/api/v2/policies/{org}")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"payload\"\r\n\r\n{\r\n \"name\": \"<string>\",\r\n \"description\": \"\",\r\n \"type\": \"env\",\r\n \"comment\": \"\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"policy_file\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.kosli.com/api/v2/policies/{org}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"payload\"\r\n\r\n{\r\n \"name\": \"<string>\",\r\n \"description\": \"\",\r\n \"type\": \"env\",\r\n \"comment\": \"\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"policy_file\"\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"name": "<string>",
"description": "<string>",
"created_by": "<string>",
"created_at": 123,
"last_modified_at": 123,
"archived": false,
"versions": [],
"events": [],
"consuming_envs": []
}{
"name": "<string>",
"description": "<string>",
"created_by": "<string>",
"created_at": 123,
"last_modified_at": 123,
"archived": false,
"versions": [],
"events": [],
"consuming_envs": []
}{
"message": "<string>",
"errors": {}
}{
"message": "<string>",
"errors": {}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
multipart/form-data
Response
Update Success
Response model for a policy
This represents the response structure when retrieving, creating or updating a policy.
Last modified on June 18, 2026
⌘I