account-key - Flow

Returns a single public key of an account by its key index, including its signing and hashing algorithms, weight, sequence number, and revocation status.

Endpoint

httpGET /v1/accounts/{address}/keys/{index}

Path Parameters

ParameterTypeDescription
addressstringFlow account address (16 hex chars)
indexstringKey index (integer, starting at 0)

Query Parameters

ParameterTypeDescription
block_heightstringBlock height, or final / sealed

Example

bashexport FLOW_REST=https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/

curl "${FLOW_REST}v1/accounts/0x1654653399040a61/keys/0"

example.js

javascriptconst axios = require('axios');

const response = await axios.get('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/v1/accounts/0x1654653399040a61/keys/0', {
    headers: { 'Content-Type': 'application/json' }
});

console.log(response.data);

example.py

pythonimport requests

response = requests.get(
    'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/v1/accounts/0x1654653399040a61/keys/0',
    headers={'Content-Type': 'application/json'}
)

print(response.json())

example.rs

rustuse reqwest::Client;
use serde_json::Value;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();

    let response = client
        .get("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/v1/accounts/0x1654653399040a61/keys/0")
        .header("Content-Type", "application/json")
        .send()
        .await?
        .json::<Value>()
        .await?;

    println!("Result: {}", response);
    Ok(())
}

Response

json{
    "index": "0",
    "public_key": "0xabc...",
    "signing_algorithm": "ECDSA_P256",
    "hashing_algorithm": "SHA3_256",
    "sequence_number": "42",
    "weight": "1000",
    "revoked": false
}

Response Fields

FieldTypeDescription
indexstringKey index
signing_algorithmstringECDSA_P256 or ECDSA_secp256k1
weightstringKey weight (1000 = full signing authority)
sequence_numberstringNext sequence number for this key
revokedbooleanWhether the key is revoked

Use Cases

  • Signing Setup: Read the sequence number before building a transaction
  • Security Audit: Check key weights and revocation

Error Handling

ErrorMessageDescription
400 / Bad requestBad requestA path, query, or body parameter was invalid
404 / Not foundNot foundThe block, account, transaction, or resource does not exist
403 / RBAC: access deniedAccess deniedThe GetBlock access token is missing or incorrect