Summary

The removeIngestToken() mutation permanently deletes an ingest token from a LogScale repository. After removal, any ingestion requests that use the deleted token are immediately rejected. Use this mutation to revoke data ingestion access when rotating credentials, retiring a log source, or decommissioning an ingestion pipeline. This mutation requires admin-level access to the repository. Before removing a token, use repository() to confirm the token name and verify it is no longer in active use.

Syntax

graphql
removeIngestToken(
      repositoryName: String!, name: String!
   ): BooleanResultType!

Both repositoryName and name are required. Provide the name of the repository that owns the token and the exact name of the token to delete. To retrieve a list of existing token names, use the repository() query shown in the preceding Related section.

The mutation returns a BooleanResultType confirming whether the removal succeeded. See the Returned Values section for field details.

Example

Raw
graphql
mutation {
  removeIngestToken(
    repositoryName: "humio",
    name: "my-token"
  )
  {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 {
  removeIngestToken(
    repositoryName: \"humio\",
    name: \"my-token\"
  )
  {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 {
  removeIngestToken(
    repositoryName: \"humio\",
    name: \"my-token\"
  )
  {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 { ^
  removeIngestToken( ^
    repositoryName: \"humio\", ^
    name: \"my-token\" ^
  ) ^
  {result} ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "mutation {
  removeIngestToken(
    repositoryName: \"humio\",
    name: \"my-token\"
  )
  {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 {
  removeIngestToken(
    repositoryName: \"humio\",
    name: \"my-token\"
  )
  {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 {
  removeIngestToken(
    repositoryName: \"humio\",
    name: \"my-token\"
  )
  {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 {
  removeIngestToken(
    repositoryName: \"humio\",
    name: \"my-token\"
  )
  {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": {
    "removeIngestToken": {
      "result": true
    }
  }
}

Input Parameters

Provide the repository name and the token name to identify which token to remove. To retrieve a list of token names before removal, use the repository() query shown in the Related section.

Table: Input Parameters & Datatypes

Parameter Type Required Default Description
This table contains all input parameters for this mutation.
name String yes   The name of the ingest token to delete. Token names are case-sensitive and must match exactly. Use the repository() query to confirm the token name before removing it.
repositoryName String yes   The name of the repository that owns the ingest token. Tokens are scoped per repository in LogScale; a token that exists in one repository does not exist in another.

Returned Values

The mutation returns a BooleanResultType indicating whether the token was successfully removed. A result value of true confirms the token was deleted and can no longer be used for data ingestion. Request the result field to verify the outcome, as shown in the Example section.

Table: BooleanResultType Datatype

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