Summary

The getFileContent() GraphQL query returns the contents of a CSV file uploaded to a repository, with optional pagination and text filtering. The file is identified by repository name and file name.

API Stability Long-Term

Syntax

graphql
getFileContent(
      name: String!,
      fileName: String!,
      offset: Int,
      limit: Int,
      filterString: String
   ): UploadedFileSnapshot!

Provide the repository name as name and the file name as fileName — both required. Optionally, provide filterString to return only rows containing that text, offset to skip a number of rows, and limit to cap the number of rows returned. See Input Parameters and Returned Values for details.

Example

Raw
graphql
query {
  getFileContent(
    fileName: "test.csv", 
    name: "humio", 
    filterString: "Barbara"
  )
  { nameAndPath{name, path}, 
    totalLinesCount,
    headers, lines
  }
}
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" : "query {
  getFileContent(
    fileName: \"test.csv\", 
    name: \"humio\", 
    filterString: \"Barbara\"
  )
  { nameAndPath{name, path}, 
    totalLinesCount,
    headers, lines
  }
}"
}
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" : "query {
  getFileContent(
    fileName: \"test.csv\", 
    name: \"humio\", 
    filterString: \"Barbara\"
  )
  { nameAndPath{name, path}, 
    totalLinesCount,
    headers, lines
  }
}"
}
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" : "query { ^
  getFileContent( ^
    fileName: \"test.csv\",  ^
    name: \"humio\",  ^
    filterString: \"Barbara\" ^
  ) ^
  { nameAndPath{name, path},  ^
    totalLinesCount, ^
    headers, lines ^
  } ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "query {
  getFileContent(
    fileName: \"test.csv\", 
    name: \"humio\", 
    filterString: \"Barbara\"
  )
  { nameAndPath{name, path}, 
    totalLinesCount,
    headers, lines
  }
}"
}'
    "$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 = "query {
  getFileContent(
    fileName: \"test.csv\", 
    name: \"humio\", 
    filterString: \"Barbara\"
  )
  { nameAndPath{name, path}, 
    totalLinesCount,
    headers, lines
  }
}";
$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" : "query {
  getFileContent(
    fileName: \"test.csv\", 
    name: \"humio\", 
    filterString: \"Barbara\"
  )
  { nameAndPath{name, path}, 
    totalLinesCount,
    headers, lines
  }
}"
}'''

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" : "query {
  getFileContent(
    fileName: \"test.csv\", 
    name: \"humio\", 
    filterString: \"Barbara\"
  )
  { nameAndPath{name, path}, 
    totalLinesCount,
    headers, lines
  }
}"
}
);


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": {
    "getFileContent": {
      "nameAndPath": {
        "name": "test.csv",
        "path": null
      },
      "totalLinesCount": 1,
      "headers": [
        "id",
        "first",
        "last"
      ],
      "lines": [
        [
          "6",
          "Barbara",
          "Mills"
        ]
      ]
    }
  }
}

This example gets the file from the repository, and returns lines containing the search text given for filterString. It also returns the name and path of the file, and the number of rows found — which is only one here. And it returns the data found matching the search text.

Input Parameters

Provide the repository name as name and the file name as fileName — both required. Optionally, provide filterString to return only rows containing that text, offset to skip a number of rows, and limit to cap the number of rows returned.

Table: Input Parameters & Datatypes

Parameter Type Required Default Description
This table contains all input parameters for this query.
fileName String yes   The name of the file to get.
filterString String     A filter related to the file's content.
limit Int     The number of lines to select in the CSV file.
name String yes   The name of the search domain.
offset Int     An offset, a starting point for the number of lines to get.

Returned Values

Returns a non-nullable UploadedFileSnapshot object. Use nameAndPath (a FileNameAndPath object) for the file's name and location — fileName, displayName, and location are deprecated since 2021-08-11 and should not be used. Other fields include headers (column names as a list of strings), lines (the data rows as a list of string lists), totalLinesCount (total matching lines across all pages, as a Long), limit, offset, and filterString (echoed back from the input). The available fields are listed here:

Table: UploadedFileSnapshot 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 
filterStringString  Long-Term Any string on which to filter the data.
headersStringyes Long-Term The headers for the uploaded snapshot file.
limitIntyes Long-Term The file upload limit.
lines[String]yes Long-Term The contents of the file in the form of a list of lines, with each line being itself a list of column values. When the file is empty or nothing matches filterString, then [] is returned.
nameAndPathFileNameAndPathyes Long-Term The name and path of the uploaded snapshot file. See FileNameAndPath.
offsetIntyes Long-Term This is the offset supplied to a file query. For a new or updated file, this is always 0.
resourceStringyes Short-Term The resource identifier for the file.
totalLinesCountLongyes Long-Term The total number of lines in the uploaded snapshot file.