Summary

The copySavedQuery() mutation creates a clone of an existing saved query in LogScale. Use it to duplicate a saved query and then modify the copy, rather than building a new query from scratch. You can copy the query to the same repository or view, or to a different one.

API Stability Preview

Syntax

graphql
copySavedQuery(
      id: String!,
      targetSearchDomainName: String,
      sourceSearchDomainName: String!,
      name: String
   ): CopySavedQueryMutation!

The required arguments are id, the unique identifier of the saved query to copy, and sourceSearchDomainName, the name of the repository or view that contains the source query. The optional targetSearchDomainName specifies the destination repository or view. The optional name sets the name for the new copy. The mutation returns a non-null CopySavedQueryMutation object containing details about the new saved query, including its identifier.

Use the Show Query Example in the Related section to retrieve the id of an existing saved query.

Example

Raw
graphql
mutation {
  copySavedQuery(
    id: "abc123",
    sourceSearchDomainName: "humio",
    name: "my_new_savedquery" 
  ) savedQuery { id }
}
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 {
  copySavedQuery(
    id: \"abc123\",
    sourceSearchDomainName: \"humio\",
    name: \"my_new_savedquery\" 
  ) savedQuery { id }
}"
}
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 {
  copySavedQuery(
    id: \"abc123\",
    sourceSearchDomainName: \"humio\",
    name: \"my_new_savedquery\" 
  ) savedQuery { id }
}"
}
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 { ^
  copySavedQuery( ^
    id: \"abc123\", ^
    sourceSearchDomainName: \"humio\", ^
    name: \"my_new_savedquery\"  ^
  ) savedQuery { id } ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "mutation {
  copySavedQuery(
    id: \"abc123\",
    sourceSearchDomainName: \"humio\",
    name: \"my_new_savedquery\" 
  ) savedQuery { id }
}"
}'
    "$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 {
  copySavedQuery(
    id: \"abc123\",
    sourceSearchDomainName: \"humio\",
    name: \"my_new_savedquery\" 
  ) savedQuery { id }
}";
$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 {
  copySavedQuery(
    id: \"abc123\",
    sourceSearchDomainName: \"humio\",
    name: \"my_new_savedquery\" 
  ) savedQuery { id }
}"
}'''

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 {
  copySavedQuery(
    id: \"abc123\",
    sourceSearchDomainName: \"humio\",
    name: \"my_new_savedquery\" 
  ) savedQuery { id }
}"
}
);


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": {
    "copySavedQuery": {
      "id": "def456"
    }
  }
}

Input Parameters

Provide the unique identifier of the saved query to copy and the name of the repository or view that contains it. Optionally, specify a destination repository or view and a name for the new copy. The preceding Related section includes an example query for retrieving saved query identifiers.

Table: Input Parameters and Datatypes

Parameter Type Required Default Description
This table contains all input parameters for this mutation.
id string yes   The unique identifier of the saved query to copy. Use the repositories() query to retrieve saved query identifiers.
name string     The name for the new saved query. If omitted, LogScale uses the original name. When copying within the same repository or view, LogScale appends (copied) to the original name to avoid a naming conflict.
sourceSearchDomainName string yes   The name of the repository or view that contains the saved query to copy.
targetSearchDomainName string     The name of the repository or view where LogScale places the new saved query. If omitted, the source repository or view is used as the destination.

Returned Values

The mutation returns a CopySavedQueryMutation object. This object contains the new saved query, represented by the SavedQuery datatype, which includes the identifier and other properties of the copy. Use the identifier to make subsequent changes through updateSavedQuery().

Table: CopySavedQueryMutation Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
Some input parameters may be required, as indicated in the Required column. For return values, this indicates that you are assured a value if the field is requested for the results. 
Table last updated: Oct 14, 2026 
savedQuerySavedQueryyes Long-Term The saved query elements. See SavedQuery.

The following table describes the SavedQuery datatype, which is the sub-type returned within CopySavedQueryMutation.

Table: SavedQuery Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
Some input parameters may be required, as indicated in the Required column. For return values, this indicates that you are assured a value if the field is requested for the results. 
Table last updated: Oct 14, 2026 
allowedActionsAssetActionyes Short-Term The allowed asset actions. See AssetAction . This is a preview and subject to change.
createdInfoAssetCommitMetadata  Long-Term Metadata related to the creation of the saved query. See AssetCommitMetadata.
descriptionString  Long-Term A description of the saved query.
displayNameStringyes Long-Term The display name of the saved query.
idStringyes Long-Term The unique identifier for the saved query.
interactionsQueryBasedWidgetInteractionyes Long-Term The interactions of the saved query. See QueryBasedWidgetInteraction.
isStarredBooleanyes Long-Term Whether the saved query has been marked with a star.
labelsStringyes Long-Term The labels associated with this saved query.
modifiedInfoAssetCommitMetadata  Long-Term Metadata related to the latest modification of the saved query. See AssetCommitMetadata.
nameStringyes Long-Term The name of the saved query.
optionsJSONyes Long-Term Options related to the saved query, in JSON form. JSON is a scalar.
packagePackageInstallation  Long-Term The package, if there is one, in which the saved query is included. See PackageInstallation.
packageIdVersionedPackageSpecifier  Long-Term The unique identifier of the package. VersionedPackageSpecifier is a scalar value.
qualifiedNameStringyes Preview The fully qualified reference format, including the view.
queryHumioQueryyes Long-Term The saved query itself. See HumioQuery.
resourceStringyes Short-Term The resource identifier for this saved query.
templateYamlStringyes  deprecated in 1.225A YAML formatted string that describes the saved query.
widgetTypeStringyes Long-Term The type of widget used with the saved query.
yamlTemplateYAMLyes Long-Term A yaml formatted string that describes the saved query. YAML is a scalar. This replaced templateYaml starting in LogScale version 1.225.