---
title: "gettxout"
description: "The gettxout RPC method allows you to retrieve details about an unspent transaction output in the Bitcoin network"
order: 64
---

# gettxout

## Overview

The **'gettxout'** RPC method allows you to retrieve details about an unspent transaction output in the Bitcoin network

## Request

### shell

```shell
wget --no-check-certificate --quiet \
  --method POST \
  --timeout=0 \
  --header 'Content-Type: application/json' \
  --header 'accept: application/json' \
  --header 'X-CoinAPI-Key: abk_3f2504e04f8941d39a0c0305e82c3301582005f7' \
  --body-data '{"jsonrpc":"2.0","id":1,"method":"gettxout","params": [ ]}' \
   'https://bitcoin-mainnet.node.coinapi.io'
```


### csharp

```csharp
--
```


### php

```php
<?php
$client = new Client();
$headers = [
  'Content-Type' => 'application/json',
  'accept' => 'application/json',
  'X-CoinAPI-Key' => 'abk_3f2504e04f8941d39a0c0305e82c3301582005f7'
];
$body = '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "gettxout",
  "params": []
}';
$request = new Request('POST', 'https://bitcoin-mainnet.node.coinapi.io', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
?>
```


### python

```python
import http.client
import json

conn = http.client.HTTPSConnection("mainnet-bitcoin.node.coinapi.io")
payload = json.dumps({
"jsonrpc": "2.0",
"id": 1,
"method": "gettxout",
"params": []
})
headers = {
'Content-Type': 'application/json',
'accept': 'application/json',
'X-CoinAPI-Key': 'abk_3f2504e04f8941d39a0c0305e82c3301582005f7'
}
conn.request("POST", "/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
```


### javascript

```javascript
var settings = {
"url": "https://bitcoin-mainnet.node.coinapi.io",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "application/json",
"accept": "application/json",
"X-CoinAPI-Key": "abk_3f2504e04f8941d39a0c0305e82c3301582005f7"
},
"data": JSON.stringify({
"jsonrpc": "2.0",
"id": 1,
"method": "gettxout",
"params": []
}),
};

$.ajax(settings).done(function (response) {
console.log(response);
});
```


### go

```go
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

url := "https://bitcoin-mainnet.node.coinapi.io"
method := "POST"

payload := strings.NewReader(`{"jsonrpc":"2.0","method":"gettxout","params": [],"id":1}`)

client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)

if err != nil {
fmt.Println(err)
return
}
req.Header.Add("x-coinapi-key", "abk_3f2504e04f8941d39a0c0305e82c3301582005f7")
req.Header.Add("Content-Type", "application/json")
req.Header.Add("accept", "application/json")

res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()

body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
```


### ruby

```ruby
require "uri"
require "json"
require "net/http"

url = URI("https://bitcoin-mainnet.node.coinapi.io")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-coinapi-key"] = "abk_3f2504e04f8941d39a0c0305e82c3301582005f7"
request["Content-Type"] = "application/json"
request["accept"] = "application/json"
request.body = JSON.dump({
"jsonrpc": "2.0",
"method": "gettxout",
"params": [],
"id": 1
})

response = https.request(request)
puts response.read_body
```


### java

```java
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n  \"jsonrpc\": \"1.0\",\r\n  \"id\": \"1\",\r\n  \"method\": \"gettxout\",\r\n  \"params\": []\r\n}\r\n");
Request request = new Request.Builder()
  .url("https://bitcoin-mainnet.node.coinapi.io")
  .method("POST", body)
  .addHeader("Content-Type", "application/json")
  .addHeader("accept", "application/json")
  .addHeader("X-CoinAPI-Key", "abk_3f2504e04f8941d39a0c0305e82c3301582005f7")
  .build();
Response response = client.newCall(request).execute();
```


## Request Parameters

**txid**

- **Type**: string
- **Required**: Yes
- **Description**: The identifier for the transaction you are querying.

**n**

- **Type**: numeric
- **Required**: Yes
- **Description**: The output number (vout) of the transaction.

**include_mempool**

- **Type**: boolean
- **Default**: true
- **Description**: Specifies whether to include the mempool in the query.

## Response

```json

```

**bestblock**

- **Description**: The hash of the block at the tip of the blockchain.

**confirmations**

- **Description**: The number of confirmations received for the transaction.

**value**

- **Description**: The value of the transaction, denominated in BTC.

**scriptPubKey**

- **Description**: A JSON object containing details about the public key script associated with the transaction.

**asm**

- **Description**: The script public key, represented as a string.

**hex**

- **Description**: The hexadecimal representation of the transaction.

**reqSigs**

- **Description**: The number of signatures required to validate the transaction.

**type**

- **Description**: The type of script used in the transaction, such as pubkeyhash or multisig.

**addresses**

- **Description**: A JSON array containing the Bitcoin addresses involved in the transaction.

**str**

- **Description**: A string representation of a Bitcoin address associated with the transaction.

**coinbase**

- **Description**: A boolean value indicating whether the transaction output is part of a coinbase transaction. Returns true for coinbase transactions and false for all others.