Skip to main content
A query that returns the current state of a file. Queries do not change the state of the file or require network consensus. The information is returned from a single node processing the query. Query Fees
  • Please see the transaction and query fees table for the base transaction fee
  • Please use the Hedera fee estimator to estimate your query fee cost
File Info Response
FieldDescription
File IDThe Hedera ID of the file
Key(s)The current admin key(s) on the account
SizeThe number of bytes in the file contents
Expiration TimeThe current time at which the file is set to expire
DeletedWhether or not the file has been deleted
Ledger IDThe ID of the network the response came from. See HIP-198.
MemoA short description, if any

Query Signing Requirements
  • The client operator account paying for the query fees is required to sign
ConstructorDescription
new FileInfoQuery()Initializes the FileInfoQuery object
new FileInfoQuery()

Methods

MethodTypeDescription
setFileId(<fileId>)FileIdThe ID of the file to get information for (x.y.z)
//Create the query
FileInfoQuery query = new FileInfoQuery()
  .setFileId(fileId);

//Sign the query with the client operator private key and submit to a Hedera network
FileInfo getInfo = query.execute(client);

System.out.println("File info response: " +getInfo);
Sample Output:
FileInfo{
     fileId=0.0.104926, 
     size=26, 
     expirationTime=2021-02-10T17:48:15Z, 
     deleted=false, 
     keys=[ 302a300506032b6570032100100059296cc51f5d362a3859d3c3c74c6a480cffad9d669a10c1d447ce56e5bf
     ]
}

Get query values

MethodTypeDescription
getFileId()FileIdThe ID of the file to get contents for (x.z.y)
//Create the query
FileInfoQuery query = new FileInfoQuery()
  .setFileId(fileId);

//Get file ID
FileId getFileId = query.getFileId();

//v2.0.0