> For the complete documentation index, see [llms.txt](https://nownodes.gitbook.io/btc-bitcoin/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nownodes.gitbook.io/btc-bitcoin/bitcoin-btc/mainnet/blockchain-rpcs/getbestblockhash.md).

# Getbestblockhash

getbestblockhash operations.

## getbestblockhash

> Returns the hash of the best block in the most-work fully-validated chain. The best block is the tip of the blockchain, representing the most recent block that has been validated and added to the chain.

```json
{"openapi":"3.0.0","info":{"title":"Bitcoin MAINNET API","version":"1.0.0"},"tags":[{"name":"getbestblockhash","description":"getbestblockhash operations."}],"servers":[{"url":"https://btc.nownodes.io","description":"NOWNodes Bitcoin MAINNET endpoint."}],"security":[{"api-keyAuth":[]}],"components":{"securitySchemes":{"api-keyAuth":{"type":"apiKey","in":"header","name":"api-key","description":"NOWNodes API key passed in the api-key header."}},"schemas":{"RpcRequest":{"type":"object","required":["jsonrpc","id","method","params"],"properties":{"jsonrpc":{"type":"string","description":"JSON-RPC protocol version."},"id":{"type":"string","description":"Client-provided request identifier echoed in the response."},"method":{"type":"string","enum":["getbestblockhash"],"description":"JSON-RPC method name."},"params":{"type":"array","items":{"description":"Single entry in the params array."},"description":"JSON-RPC method parameters."}},"description":"Request payload containing the documented method parameters and client request identifier."},"GetbestblockhashResponse":{"type":"object","required":["result","error","id"],"properties":{"result":{"type":"string","nullable":true,"description":"Method-specific result returned by getbestblockhash."},"error":{"oneOf":[{"$ref":"#/components/schemas/JsonRpcError"},{"type":"string","description":"JSON-RPC error object. Null when the request succeeds."}],"nullable":true,"description":"JSON-RPC error object or null on success."},"id":{"oneOf":[{"type":"string","description":"Client-provided request identifier echoed in the response."},{"type":"integer","description":"Client-provided request identifier echoed in the response."}],"nullable":true,"description":"Request id echoed by the server."}},"additionalProperties":true,"description":"Object containing getbestblockhash response details."},"JsonRpcError":{"type":"object","required":["code","message"],"properties":{"code":{"type":"integer","description":"JSON-RPC error code."},"message":{"type":"string","description":"Human-readable error message."}},"additionalProperties":true,"description":"Object containing json rpc error details."},"UnauthorizedPlainTextError":{"type":"string","description":"Plain-text response returned when an API key is present but not accepted by NOWNodes."},"MethodNotAllowedPlainTextError":{"type":"string","description":"Plain-text response returned by the gateway for malformed or unsupported gateway-level requests."},"MissingApiKeyPlainTextError":{"type":"string","description":"Plain-text response returned when the api-key header is missing."}}},"paths":{"/":{"post":{"summary":"getbestblockhash","tags":["getbestblockhash"],"description":"Returns the hash of the best block in the most-work fully-validated chain. The best block is the tip of the blockchain, representing the most recent block that has been validated and added to the chain.","operationId":"getbestblockhash","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RpcRequest"}}},"description":"Returns the hash of the best block in the most-work fully-validated chain. The best block is the tip of the blockchain, representing the most recent block that has been validated and added to the chain."},"responses":{"200":{"description":"Valid response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetbestblockhashResponse"}}}},"401":{"description":"Unauthorized: API key is present but rejected by the NOWNodes gateway.","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/UnauthorizedPlainTextError"}}}},"405":{"description":"Method Not Allowed. Returned by the NOWNodes gateway for malformed or unsupported gateway-level requests.","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/MethodNotAllowedPlainTextError"}}}},"422":{"description":"Missing API key. The NOWNodes gateway returns plain text for this error.","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/MissingApiKeyPlainTextError"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetbestblockhashResponse"}}}}}}}}}
```
