# Transaction Info

## Fetch Transaction Data

Fetch a specific contact's data in an inabit organization, according to the contact's ID.

Using this endpoint users can request information on a specific transaction by its transaction ID in their inabit account.

```graphql
query Transaction($where: TransactionWhereUniqueInput!) {
  transaction(where: $where) {
    id
    amount
    blockchain {
      name
      code
    }
    createdAt
    createdBy {
      fullName
    }
    fee
    note
    status {
      status
    }
    wallet {
      name
      id
    }
    financialAsset {
      code
    }
    isAccelerated
    priority
    rateUSD
    rateEUR
    kyt
  }
}
```

### **Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

### Body (<mark style="color:orange;">TransactionWhereUniqueInput</mark>) object

| Name                                 | Type   | Description    |
| ------------------------------------ | ------ | -------------- |
| id<mark style="color:red;">\*</mark> | String | Transaction ID |

Example body:

```graphql
{
  "where": {
    "id": "clllyfhdj00w9btqke47wsesx"
  }
}
```

### Response

Return values:

| Name                  | Type     | Description                                                                                                                                                            |
| --------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| id                    | String   | Transaction ID                                                                                                                                                         |
| amount                | String   | Transaction Amount (in cryptocurrency)                                                                                                                                 |
| name (blockchain)     | String   | Blockchain Name                                                                                                                                                        |
| code (blockchain)     | String   | Blockchain Code                                                                                                                                                        |
| createdAt             | Datetime | Creation Time                                                                                                                                                          |
| fullName (createdBy)  | String   | Full Name of Initiator                                                                                                                                                 |
| fee                   | Integer  | Transaction Fee                                                                                                                                                        |
| note                  | String   | Transaction Note                                                                                                                                                       |
| status                | String   | Transaction Status                                                                                                                                                     |
| name (wallet)         | String   | Wallet Name                                                                                                                                                            |
| id (wallet)           | String   | Wallet ID                                                                                                                                                              |
| code (financialAsset) | String   | FinancialAsset Code (i.e - "ETH" / "BTC")                                                                                                                              |
| isAccelerated         | Boolean  | Flag that indicates wether the transaction is [accelerated](https://docs.inabit.com/api-reference/develop-with-inabit-api/transactions/broken-reference). (true/false) |
| priority              | String   | <p>Transaction Priority<br>(Slow, Medium, Fast, etc.)</p>                                                                                                              |
| rateUSD               | Integer  | Asset Rate at the time of the Transaction (in USD)                                                                                                                     |
| rateEUR               | Integer  | Asset Rate at the time of the Transaction (in Euro)                                                                                                                    |
| kyt                   | String   | <p>KYT (Know-Your-Transaction) risk score.<br>0 - Worst score<br>10 - Best Score</p>                                                                                   |

{% tabs %}
{% tab title="🟢 Success" %}

```javascript
{
	"data": {
		"transaction": {
			"id": "clk10q8he002kk660o1ed8ud4",
			"transactionType": "Withdrawal",
			"createdAt": "2023-07-13T10:39:42.963Z",
			"createdBy": {
				"fullName": "admin admin",
				"firstName": "admin",
				"lastName": "admin",
				"id": "cljzumg980000k603eaitu5sq",
				"profileFile": null
			},
			"txId": null,
			"contactCryptoAccount": {
				"address": "0xcce6de61f9abdb6b43effee5dd603bb7c6ee3fc6",
				"name": "Binance Smart Chain d97e1c12",
				"contact": {
					"name": "Wesley Hermann"
				}
			},
			"kyt": 6,
			"wallet": {
				"id": "cljzumgyb000ik603z04lxgyk",
				"name": "REAL WALLET Wallet",
				"externalId": "6422985cfa2a9b000726588b",
				"organization": {
					"id": "cljzumgxa0009k603wl8foc6x"
				},
				"organizationExchange": null
			},
			"financialAsset": {
				"id": "clefn78h5012plc6rxbmofnop",
				"code": "ETH",
				"name": "Ethereum",
				"precision": 8
			},
			"blockchain": {
				"id": "clefn78cl00i3lc6rih442mx9",
				"name": "Ethereum",
				"code": "ethereum",
				"contractType": "ERC20",
				"networkScannerUrl": "https://etherscan.io/tx/"
			},
			"amount": 0.5,
			"rateEUR": null,
			"rateUSD": null,
			"status": {
				"category": "InProgress",
				"status": "Processing",
				"exchangeStatuses": [],
				"transactionSubStatuses": [
					{
						"subStatus": "WaitingExecution"
					},
					{
						"subStatus": "InExecution"
					}
				]
			},
			"fee": null,
			"note": "",
			"swapAssetTo": null,
			"swapToAmount": null,
			"metaData": [
				{
					"value": "0.5",
					"transactionMetaDataField": {
						"id": "zb88n54ipqwjspo1wyw35nf5",
						"name": "requestedAmount"
					}
				}
			]
		}
	}
}
```

{% endtab %}

{% tab title="🔴 Failure" %}

{% endtab %}
{% endtabs %}

**How do I retrieve my transaction ID?**

In order to retrieve a transaction's identifier, you'll need to query all of an organization's transactions first, and fetch the specific transaction ID.

```graphql
query Transactions($where: TransactionWhereInput) {
  transactions(where: $where) {
    id
  }
}
```

Example body:

```graphql
{
  "where": {
    "wallet": {
      "organization": {
        "id": ""
      }
    }
  }
}
```

### Try it out!

{% embed url="<https://studio.apollographql.com/sandbox/explorer?endpoint=https://api.inabit.dev/graphql&explorerURLState=N4IgJg9gxgrgtgUwHYBcQC4QEcYIE4CeABACp4CGSAzuVCgJYRIAUAJAO4AW+C6pF1WgyYB1bngQBVJPRwIAkkgAOMFAEIAlEWAAdJESIoBNOoxZcefDuIRbd+g0Xpg9jouTgQYqV44BGADbQANZQnOT0+vZuBkgeCL5uUBBgCQ4GAL6JRFAS5CgIYACCKNm5CPmFAELE0TEAZjABAQBy8dlZ6UT1CGluSBAF2VQo+TBU2tkGI2NUHdns5M0IKJNdse3rTi5dnW71kZRQ9EtFVFQrazE5KX2Oe470VEVQUAgB+JU7bkp4jH8oAjZCgFSQAZQAIsDKgBRSQAJWywQIpQcnQyIAANCAAG7kP7kQIIKgYEB1HQgCwSCl8OoGCnOGlEClQZoBAj1ThgABWAAZeewAJx+FBYYIIAAsAHZ2BcqAAPCm+dFYkBKCAjeoBegAc04KAA8kpPsIkGDcvQlGhMCAMkA>" %}
