Summary

A read-only token is an unauthenticated shared link to a LogScale dashboard. Anyone with the link URL can view the dashboard without a LogScale account or API token. The deleteReadonlyToken() mutation deletes one of these links, immediately invalidating the URL. The dashboard itself is not affected.

Delete a read-only token when the link is no longer needed, when access should be revoked for security reasons, or to rotate the link by deleting the current token and creating a new one with createReadonlyToken(). The mutation requires both the internal token identifier and the token string value as a dual-confirmation guard against accidentally deleting the wrong token.

Syntax

graphql
deleteReadonlyToken(
      id: String!, token: String!
   ): BooleanResultType!

Both id and token are required. The id is the internal database identifier of the token record; token is the opaque string embedded in the shared URL. Requiring both values prevents accidentally deleting the wrong token when multiple shared links exist for the same dashboard. The mutation returns a non-null BooleanResultType where result: true confirms the link is now invalid.

Example

Raw
graphql
mutation {
  deleteReadonlyToken( 
        id: "abc123",
        token: "def456"
  )
  {result}
}
Mac OS or Linux (curl)
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    -d @- << EOF
{"query" : "mutation {
  deleteReadonlyToken( 
        id: \"abc123\",
        token: \"def456\"
  )
  {result}
}"
}
EOF
Mac OS or Linux (curl) One-line
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    -d @- << EOF
{"query" : "mutation {
  deleteReadonlyToken( 
        id: \"abc123\",
        token: \"def456\"
  )
  {result}
}"
}
EOF
Windows Cmd and curl
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql ^
    -H "Authorization: Bearer $TOKEN" ^
    -H "Content-Type: application/json" ^
    -d @'{"query" : "mutation { ^
  deleteReadonlyToken(  ^
        id: \"abc123\", ^
        token: \"def456\" ^
  ) ^
  {result} ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "mutation {
  deleteReadonlyToken( 
        id: \"abc123\",
        token: \"def456\"
  )
  {result}
}"
}'
    "$YOUR_LOGSCALE_URL/graphql"
Perl
perl
#!/usr/bin/perl

use HTTP::Request;
use LWP;

my $TOKEN = "TOKEN";

my $uri = '$YOUR_LOGSCALE_URL/graphql';

my $query = "mutation {
  deleteReadonlyToken( 
        id: \"abc123\",
        token: \"def456\"
  )
  {result}
}";
$query =~ s/\n/ /g;
my $json = sprintf('{"query" : "%s"}',$query);
my $req = HTTP::Request->new("POST", $uri );

$req->header("Authorization" => "Bearer $TOKEN");
$req->header("Content-Type" => "application/json");

$req->content( $json );

my $lwp = LWP::UserAgent->new;

my $result = $lwp->request( $req );

print $result->{"_content"},"\n";
Python
python
#! /usr/local/bin/python3

import requests

url = '$YOUR_LOGSCALE_URL/graphql'
mydata = r'''{"query" : "mutation {
  deleteReadonlyToken( 
        id: \"abc123\",
        token: \"def456\"
  )
  {result}
}"
}'''

resp = requests.post(url,
                     data = mydata,
                     headers = {
   "Authorization" : "Bearer $TOKEN",
   "Content-Type" : "application/json"
}
)

print(resp.text)
Node.js
javascript
const https = require('https');

const data = JSON.stringify(
    {"query" : "mutation {
  deleteReadonlyToken( 
        id: \"abc123\",
        token: \"def456\"
  )
  {result}
}"
}
);


const options = {
  hostname: '$YOUR_LOGSCALE_URL',
  path: 'graphql',
  port: 443,
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Content-Length': data.length,
    Authorization: 'BEARER ' + process.env.TOKEN,
    'User-Agent': 'Node',
  },
};

const req = https.request(options, (res) => {
  let data = '';
  console.log(`statusCode: ${res.statusCode}`);

  res.on('data', (d) => {
    data += d;
  });
  res.on('end', () => {
    console.log(JSON.parse(data).data);
  });
});

req.on('error', (error) => {
  console.error(error);
});

req.write(data);
req.end();
Example Responses
Success (HTTP Response Code 200 OK)
json
{
  "data": {
    "deleteReadonlyToken": {
      "result": true
    }
  }
}

Input Parameters

Both input parameters are required and must match the same token record. Use the dashboard() query with readonlyTokens in the return fields to retrieve both values for an existing shared link.

Table: Input Parameters & Datatypes

Parameter Type Required Default Description
This table contains all input parameters for this mutation.
id String yes   The internal identifier assigned to the token record when the shared link was created. Use the dashboard() query with readonlyTokens { id } in the return fields to retrieve this value. It is also returned by createReadonlyToken().
token String yes   The opaque token string embedded in the shared dashboard URL. This value matches the token field returned by createReadonlyToken() and included in the shared link. Providing this value alongside id confirms the correct token record is targeted when multiple shared links exist for the same dashboard.

Returned Values

The mutation returns a non-null BooleanResultType. A result value of true confirms the shared link is deleted and the URL is immediately invalid. A value of false indicates the deletion did not complete, which can occur if the id and token values do not match the same record or the token no longer exists.

Table: BooleanResultType Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
resultBooleanyes Long-Term Whether the mutation was performed successfully.