Skip to main content
PATCH
/
v1
/
template
Update Template
curl --request PATCH \
  --url https://api.projectdiscovery.io/v1/template \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "template": "<string>",
  "template_id": "<string>",
  "prompt": "<string>",
  "filename": "<string>",
  "dir": "<string>"
}
'
import requests

url = "https://api.projectdiscovery.io/v1/template"

payload = {
"template": "<string>",
"template_id": "<string>",
"prompt": "<string>",
"filename": "<string>",
"dir": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}

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

print(response.text)
const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
template: '<string>',
template_id: '<string>',
prompt: '<string>',
filename: '<string>',
dir: '<string>'
})
};

fetch('https://api.projectdiscovery.io/v1/template', 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://api.projectdiscovery.io/v1/template",
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([
'template' => '<string>',
'template_id' => '<string>',
'prompt' => '<string>',
'filename' => '<string>',
'dir' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);

$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://api.projectdiscovery.io/v1/template"

payload := strings.NewReader("{\n \"template\": \"<string>\",\n \"template_id\": \"<string>\",\n \"prompt\": \"<string>\",\n \"filename\": \"<string>\",\n \"dir\": \"<string>\"\n}")

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

req.Header.Add("X-API-Key", "<api-key>")
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://api.projectdiscovery.io/v1/template")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"template\": \"<string>\",\n \"template_id\": \"<string>\",\n \"prompt\": \"<string>\",\n \"filename\": \"<string>\",\n \"dir\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.projectdiscovery.io/v1/template")

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

request = Net::HTTP::Patch.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"template\": \"<string>\",\n \"template_id\": \"<string>\",\n \"prompt\": \"<string>\",\n \"filename\": \"<string>\",\n \"dir\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "message": "<string>",
  "template_id": "<string>",
  "template_name": "<string>",
  "status": true,
  "template": {
    "uri": "<string>",
    "id": "<string>",
    "name": "<string>",
    "author": [
      "<string>"
    ],
    "tags": [
      "<string>"
    ],
    "severity": "<string>",
    "type": "<string>",
    "dir": "<string>",
    "ref": "<string>",
    "vendor": "<string>",
    "product": "<string>",
    "classification": {
      "cve-id": [
        "<string>"
      ],
      "cwe-id": [
        "<string>"
      ],
      "cvss-metrics": "<string>",
      "cvss-score": 123,
      "epss-score": 123,
      "epss-percentile": 123,
      "cpe": "<string>"
    },
    "metadata": {},
    "digest": "<string>",
    "created_at": "2023-11-07T05:31:56Z",
    "updated_at": "2023-11-07T05:31:56Z",
    "release_tag": "<string>",
    "is_early": true,
    "raw": "<string>",
    "template_id": "<string>",
    "description": "<string>",
    "filename": "<string>",
    "impact": "<string>",
    "ai_meta": {
      "model_used": "<string>",
      "is_prompt_by_human": true,
      "is_template_by_human": true,
      "prompt": "<string>"
    },
    "references": [
      "<string>"
    ],
    "is_draft": true,
    "is_github": true,
    "is_new": true,
    "is_pdteam": true,
    "remediation": "<string>"
  }
}
{
"message": "<string>"
}
{
"message": "<string>"
}
{
"message": "<string>"
}
{
"message": "<string>",
"kind": "<string>",
"code": "<string>",
"error": "<string>",
"error_id": "<string>",
"param": "<string>",
"status": 123
}

Authorizations

X-API-Key
string
header
required

Headers

X-Team-Id
string

Body

application/json
template
string
required
template_id
string
required
prompt
string
filename
string
dir
string

Response

Example response

message
string
required
template_id
string
required
template_name
string
required
status
boolean
template
object

Template Document or object