---
title: "gettransaction"
description: "The gettransaction method allows you to retrieve detailed information about a specific transaction on the Bitcoin network. This method returns a JSON object containing various details about the tra..."
order: 63
---

# gettransaction

## Overview

The **'gettransaction'** method allows you to retrieve detailed information about a specific transaction on the Bitcoin network. This method returns a JSON object containing various details about the transaction, including the amount, fee, confirmations, and more.

## 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":"gettransaction","params": [ ]}' \
   'https://bitcoin-mainnet.node.coinapi.io'
```


### csharp

```csharp
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://bitcoin-mainnet.node.coinapi.io");
request.Headers.Add("accept", "application/json");
request.Headers.Add("X-CoinAPI-Key", "abk_3f2504e04f8941d39a0c0305e82c3301582005f7");
var content = new StringContent("{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"gettransaction\",\"params\": [ ]}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
```


### 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": "gettransaction",
  "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": "gettransaction",
"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": "gettransaction",
    "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","id":1,"method":"gettransaction","params": [ ]}`)

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

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

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["Content-Type"] = "application/json"
request["accept"] = "application/json"
request["X-CoinAPI-Key"] = "abk_3f2504e04f8941d39a0c0305e82c3301582005f7"
request.body = JSON.dump({
  "jsonrpc": "2.0",
  "id": 1,
  "method": "gettransaction",
  "params": []
})

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, "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"gettransaction\",\"params\": [ ]}");
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

- **transaction_id** (string): The ID of the transaction you want to retrieve information about.
- **verbose** (boolean): Optional. If set to true, the method will return a decoded version of the transaction, similar to the output of the decoderawtransaction or getrawtransaction method when verbose is passed.

## Response

```json
{
  "amount": "n",
  "fee": "n",
  "confirmations": "n",
  "blockhash": "hex",
  "blockheight": "n",
  "blockindex": "n",
  "blocktime": "xxx",
  "txid": "hex",
  "walletconflicts": ["hex"],
  "time": "xxx",
  "timereceived": "xxx",
  "details": [
    {
      "address": "str",
      "category": "str",
      "amount": "n",
      "vout": "n",
      "fee": "n",
      "abandoned": "true|false"
    }
  ],
  "hex": "hex",
  "decoded": {
    // Decoded transaction details (only present when `verbose` is passed)
  }
}
```