Delete a file from an existing path
curl --request DELETE \
--url https://api.diversion.dev/v0/repos/{repo_id}/files/{ref_id}/{path} \
--header 'Authorization: Bearer <token>' \
--header 'X-DV-Client-ID: <x-dv-client-id>'import requests
url = "https://api.diversion.dev/v0/repos/{repo_id}/files/{ref_id}/{path}"
headers = {
"X-DV-Client-ID": "<x-dv-client-id>",
"Authorization": "Bearer <token>"
}
response = requests.delete(url, headers=headers)
print(response.text)const options = {
method: 'DELETE',
headers: {'X-DV-Client-ID': '<x-dv-client-id>', Authorization: 'Bearer <token>'}
};
fetch('https://api.diversion.dev/v0/repos/{repo_id}/files/{ref_id}/{path}', 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.diversion.dev/v0/repos/{repo_id}/files/{ref_id}/{path}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"X-DV-Client-ID: <x-dv-client-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.diversion.dev/v0/repos/{repo_id}/files/{ref_id}/{path}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("X-DV-Client-ID", "<x-dv-client-id>")
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.delete("https://api.diversion.dev/v0/repos/{repo_id}/files/{ref_id}/{path}")
.header("X-DV-Client-ID", "<x-dv-client-id>")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.diversion.dev/v0/repos/{repo_id}/files/{ref_id}/{path}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["X-DV-Client-ID"] = '<x-dv-client-id>'
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"status": 403,
"detail": "User not authorized to perform the requested action on the resource",
"title": "<string>",
"type": "<string>"
}{
"status": 403,
"detail": "User not authorized to perform the requested action on the resource",
"title": "<string>",
"type": "<string>"
}File Mutation
Delete file
Deletes a file or directory at the specified path in a workspace.
Requirements:
- The
ref_idmust be a workspace ID - Requires a client ID header
Behavior: The deletion is recorded in the workspace’s draft commit and can be reverted before committing.
Returns:
404 Not Foundif the path doesn’t exist202 Acceptedon successful deletion
DELETE
/
repos
/
{repo_id}
/
files
/
{ref_id}
/
{path}
Delete a file from an existing path
curl --request DELETE \
--url https://api.diversion.dev/v0/repos/{repo_id}/files/{ref_id}/{path} \
--header 'Authorization: Bearer <token>' \
--header 'X-DV-Client-ID: <x-dv-client-id>'import requests
url = "https://api.diversion.dev/v0/repos/{repo_id}/files/{ref_id}/{path}"
headers = {
"X-DV-Client-ID": "<x-dv-client-id>",
"Authorization": "Bearer <token>"
}
response = requests.delete(url, headers=headers)
print(response.text)const options = {
method: 'DELETE',
headers: {'X-DV-Client-ID': '<x-dv-client-id>', Authorization: 'Bearer <token>'}
};
fetch('https://api.diversion.dev/v0/repos/{repo_id}/files/{ref_id}/{path}', 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.diversion.dev/v0/repos/{repo_id}/files/{ref_id}/{path}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"X-DV-Client-ID: <x-dv-client-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.diversion.dev/v0/repos/{repo_id}/files/{ref_id}/{path}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("X-DV-Client-ID", "<x-dv-client-id>")
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.delete("https://api.diversion.dev/v0/repos/{repo_id}/files/{ref_id}/{path}")
.header("X-DV-Client-ID", "<x-dv-client-id>")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.diversion.dev/v0/repos/{repo_id}/files/{ref_id}/{path}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["X-DV-Client-ID"] = '<x-dv-client-id>'
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"status": 403,
"detail": "User not authorized to perform the requested action on the resource",
"title": "<string>",
"type": "<string>"
}{
"status": 403,
"detail": "User not authorized to perform the requested action on the resource",
"title": "<string>",
"type": "<string>"
}Path Parameters
Response
File deleted

