Revoke credential
Sets the credential's bit in its bitstring status list and returns the re-signed list, so verifiers see it revoked. Revoking a credential again returns the list unchanged. An agent certification can be revoked only by a caller in its own organization: a holder of organization-level manage_programs, or the auditor who authorized it, who must revoke through the Governance Service so it can vouch for the request with X-Governance-Authorization. Any other credential needs revoke_credentials in at least one project.
https://<host>/credentials/v1/revoke/{credentialId}curl --request POST \
--url 'https://<host>/credentials/v1/revoke/{credentialId}' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{"credentialStatus":{"statusListCredential":"http://localhost:3050/credentials/v1/status-lists/bea5c950-15c2-4d28-a5a0-4638dcce30b2","statusListIndex":"0"}}'const response = await fetch("https://<host>/credentials/v1/revoke/{credentialId}", {
method: "POST",
headers: {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"credentialStatus": {
"statusListCredential": "http://localhost:3050/credentials/v1/status-lists/bea5c950-15c2-4d28-a5a0-4638dcce30b2",
"statusListIndex": "0"
}
})
});
const data = await response.json();const response = await fetch("https://<host>/credentials/v1/revoke/{credentialId}", {
method: "POST",
headers: {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"credentialStatus": {
"statusListCredential": "http://localhost:3050/credentials/v1/status-lists/bea5c950-15c2-4d28-a5a0-4638dcce30b2",
"statusListIndex": "0"
}
})
});
if (!response.ok) throw new Error(`${response.status} ${response.statusText}`);
const data: unknown = await response.json();import requests
response = requests.post(
"https://<host>/credentials/v1/revoke/{credentialId}",
headers={
"Authorization": "Bearer <token>",
"Content-Type": "application/json",
},
json={
"credentialStatus": {
"statusListCredential": "http://localhost:3050/credentials/v1/status-lists/bea5c950-15c2-4d28-a5a0-4638dcce30b2",
"statusListIndex": "0",
},
},
)
response.raise_for_status()
print(response.json())package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
body := strings.NewReader(`{
"credentialStatus": {
"statusListCredential": "http://localhost:3050/credentials/v1/status-lists/bea5c950-15c2-4d28-a5a0-4638dcce30b2",
"statusListIndex": "0"
}
}`)
req, err := http.NewRequest(http.MethodPost, "https://<host>/credentials/v1/revoke/{credentialId}", body)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, err := io.ReadAll(res.Body)
if err != nil {
panic(err)
}
fmt.Println(res.Status, string(data))
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://<host>/credentials/v1/revoke/{credentialId}"))
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("""
{
"credentialStatus": {
"statusListCredential": "http://localhost:3050/credentials/v1/status-lists/bea5c950-15c2-4d28-a5a0-4638dcce30b2",
"statusListIndex": "0"
}
}
"""))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode() + " " + response.body());
}
}using System.Net.Http.Headers;
using System.Text;
using var client = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Post, "https://<host>/credentials/v1/revoke/{credentialId}");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", "<token>");
request.Content = new StringContent("""
{
"credentialStatus": {
"statusListCredential": "http://localhost:3050/credentials/v1/status-lists/bea5c950-15c2-4d28-a5a0-4638dcce30b2",
"statusListIndex": "0"
}
}
""", Encoding.UTF8, "application/json");
using var response = await client.SendAsync(request);
Console.WriteLine($"{(int)response.StatusCode} {await response.Content.ReadAsStringAsync()}");<?php
$ch = curl_init('https://<host>/credentials/v1/revoke/{credentialId}');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer <token>',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => <<<'JSON'
{
"credentialStatus": {
"statusListCredential": "http://localhost:3050/credentials/v1/status-lists/bea5c950-15c2-4d28-a5a0-4638dcce30b2",
"statusListIndex": "0"
}
}
JSON,
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
echo $status . " " . $response . PHP_EOL;require "net/http"
uri = URI("https://<host>/credentials/v1/revoke/{credentialId}")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer <token>"
request["Content-Type"] = "application/json"
request.body = <<~'JSON'
{
"credentialStatus": {
"statusListCredential": "http://localhost:3050/credentials/v1/status-lists/bea5c950-15c2-4d28-a5a0-4638dcce30b2",
"statusListIndex": "0"
}
}
JSON
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
http.request(request)
end
puts "#{response.code} #{response.body}"// Cargo.toml dependencies: reqwest (features "json"), serde_json, tokio (features "full")
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let response = reqwest::Client::new()
.post("https://<host>/credentials/v1/revoke/{credentialId}")
.header("Authorization", "Bearer <token>")
.json(&json!({
"credentialStatus": {
"statusListCredential": "http://localhost:3050/credentials/v1/status-lists/bea5c950-15c2-4d28-a5a0-4638dcce30b2",
"statusListIndex": "0"
}
}))
.send()
.await?;
println!("{} {}", response.status(), response.text().await?);
Ok(())
}Authorizations
BearerAuth· HTTP bearer (JWT)
Parameters
Path parameters
| Name | Type | Description |
|---|---|---|
credentialIdrequired | string | Credential identifier |
Header parameters
| Name | Type | Description |
|---|---|---|
X-Governance-Authorization | string | null | Governance's own bearer token, |
Request bodyrequired
credentialStatusCredentialStatusrequiredShow CredentialStatus
statusListCredentialstringrequiredstatusListIndexstringrequired
{
"credentialStatus": {
"statusListCredential": "http://localhost:3050/credentials/v1/status-lists/bea5c950-15c2-4d28-a5a0-4638dcce30b2",
"statusListIndex": "0"
}
}Responses
200The status list credential, re-signed with the credential's bit set
any
401Missing or invalid bearer token, or the X-Governance-Authorization header is malformed or Auth Service refuses its token
callstackobjectShow properties
object | nullerrorstringrequired
{
"callstack": {},
"error": "string"
}403Caller holds revoke_credentials in no project, or, for an agent certification, neither holds organization-level manage_programs nor authorized the certification, or authorized it but the request carries no X-Governance-Authorization header whose token holds organization-level certify_agents
callstackobjectShow properties
object | nullerrorstringrequired
{
"callstack": {},
"error": "string"
}404No revocation status is allocated for the credential, the request names another status list or index, or the credential is another organization's agent certification
callstackobjectShow properties
object | nullerrorstringrequired
{
"callstack": {},
"error": "string"
}500Internal error
callstackobjectShow properties
object | nullerrorstringrequired
{
"callstack": {},
"error": "string"
}503Auth Service unavailable
callstackobjectShow properties
object | nullerrorstringrequired
{
"callstack": {},
"error": "string"
}