collection-by-id - Flow

Returns a collection by ID. A collection is a batch of transactions grouped by a collection node and referenced from a block's collection guarantees. By default the response lists links to the collection's transactions; use expand to include the full transaction bodies.

Endpoint

httpGET /v1/collections/{id}

Path Parameters

ParameterTypeDescription
idstringCollection ID (hex)

Query Parameters

ParameterTypeDescription
expandstringExpand transactions
selectstringComma-separated fields to return

Example

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

curl "${FLOW_REST}v1/collections/7bc5d4e3f2a1b0c9d8e7f6a5b4c3d2e1f0a9b8c7d6e5f4a3b2c1d0e9f8a7b6c5"

example.js

javascriptconst axios = require('axios');

const response = await axios.get('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/v1/collections/7bc5d4e3f2a1b0c9d8e7f6a5b4c3d2e1f0a9b8c7d6e5f4a3b2c1d0e9f8a7b6c5', {
    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/collections/7bc5d4e3f2a1b0c9d8e7f6a5b4c3d2e1f0a9b8c7d6e5f4a3b2c1d0e9f8a7b6c5',
    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/collections/7bc5d4e3f2a1b0c9d8e7f6a5b4c3d2e1f0a9b8c7d6e5f4a3b2c1d0e9f8a7b6c5")
        .header("Content-Type", "application/json")
        .send()
        .await?
        .json::<Value>()
        .await?;

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

Response

json{
    "id": "7bc5...",
    "_expandable": {
        "transactions": [
            "/v1/transactions/a1b2..."
        ]
    },
    "_links": {
        "_self": "/v1/collections/7bc5..."
    }
}

Response Fields

FieldTypeDescription
idstringCollection ID
transactionsarrayFull transactions in the collection (when expanded)
_expandable.transactionsarrayLinks to the collection's transactions (when not expanded)
_links._selfstringPath of this collection resource

Use Cases

  • Block Decoding: Resolve a block's collection guarantees into their transactions
  • Transaction Indexing: List every transaction ID included in a collection

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