Update API key
curl --request PATCH \
--url https://api.lighton.ai/api/v3/keys/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"scopes": [
{
"workspace_id": 2
}
]
}
'import requests
url = "https://api.lighton.ai/api/v3/keys/{id}"
payload = {
"name": "<string>",
"scopes": [{ "workspace_id": 2 }]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', scopes: [{workspace_id: 2}]})
};
fetch('https://api.lighton.ai/api/v3/keys/{id}', 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.lighton.ai/api/v3/keys/{id}",
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>',
'scopes' => [
[
'workspace_id' => 2
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://api.lighton.ai/api/v3/keys/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"scopes\": [\n {\n \"workspace_id\": 2\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.lighton.ai/api/v3/keys/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"scopes\": [\n {\n \"workspace_id\": 2\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lighton.ai/api/v3/keys/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"scopes\": [\n {\n \"workspace_id\": 2\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"prefix": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z",
"scopes": [
{
"workspace_id": 123,
"workspace_name": "<string>",
"workspace_upload_method": "<string>",
"workspace_datasource_type": "<string>",
"role": "<string>"
}
]
}{
"id": null,
"code": 400,
"error": "bad_request",
"detail": "Cannot grant viewer permission on workspace 42: you only have editor role.",
"doc_url": "https://developers.lighton.ai/errors#bad_request"
}{
"id": null,
"code": 401,
"error": "unauthorized",
"detail": "Authentication credentials were not provided or are invalid.",
"doc_url": "https://developers.lighton.ai/errors#unauthorized"
}{
"id": null,
"code": 404,
"error": "not_found",
"detail": "The requested resource was not found.",
"doc_url": "https://developers.lighton.ai/errors#not_found"
}API Keys
Update API key
Update an existing API key.
Supports renaming and replacing the workspace scope:
- Pass
scopeswith a non-empty list of{workspace_id, permission}entries to replace the full scope set. Existing scope rows not in the new list are dropped. - Pass
scopes: []to unscope the key entirely. - The permission ceiling on each scoped workspace is re-validated against your current role there.
PATCH
/
api
/
v3
/
keys
/
{id}
Update API key
curl --request PATCH \
--url https://api.lighton.ai/api/v3/keys/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"scopes": [
{
"workspace_id": 2
}
]
}
'import requests
url = "https://api.lighton.ai/api/v3/keys/{id}"
payload = {
"name": "<string>",
"scopes": [{ "workspace_id": 2 }]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', scopes: [{workspace_id: 2}]})
};
fetch('https://api.lighton.ai/api/v3/keys/{id}', 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.lighton.ai/api/v3/keys/{id}",
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>',
'scopes' => [
[
'workspace_id' => 2
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://api.lighton.ai/api/v3/keys/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"scopes\": [\n {\n \"workspace_id\": 2\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.lighton.ai/api/v3/keys/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"scopes\": [\n {\n \"workspace_id\": 2\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lighton.ai/api/v3/keys/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"scopes\": [\n {\n \"workspace_id\": 2\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"prefix": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z",
"scopes": [
{
"workspace_id": 123,
"workspace_name": "<string>",
"workspace_upload_method": "<string>",
"workspace_datasource_type": "<string>",
"role": "<string>"
}
]
}{
"id": null,
"code": 400,
"error": "bad_request",
"detail": "Cannot grant viewer permission on workspace 42: you only have editor role.",
"doc_url": "https://developers.lighton.ai/errors#bad_request"
}{
"id": null,
"code": 401,
"error": "unauthorized",
"detail": "Authentication credentials were not provided or are invalid.",
"doc_url": "https://developers.lighton.ai/errors#unauthorized"
}{
"id": null,
"code": 404,
"error": "not_found",
"detail": "The requested resource was not found.",
"doc_url": "https://developers.lighton.ai/errors#not_found"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
application/jsonapplication/x-www-form-urlencodedmultipart/form-data
⌘I