Skip to main content

Expanding Sign in with Coinbase Resources

Deprecating Expanding Resources for List/Show Transactions on February 7

On 7 February 2024, we are deprecating Expanding Resources on two Transaction endpoints.

On 31 March 2024, this feature will be removed from these endpoints entirely (but not other endpoints).

Many resources, like transactions, have other resources linked to them. By default only resource, id, resource_path are exposed, and can be used to fetch the resource separately.

In some cases it's useful to expand the resource in the response body. While this might increase the request time and payload, it is faster than fetching several resources separately.

Resources are expanded by passing an array of fields with the expand parameter (e.g., ?expand[]=to&expand[]=account). This can be done both when fetching existing or creating new resources.

To expand all available resources, pass expand=all. This is useful with large and complex resources like transactions, but it makes queries slower and increases the request payload size.

Show Transactions

curl https://api.coinbase.com/v2/accounts/8fcd97cd-50ca-5803-8c27-1146e54b1c09/transactions/0ec2de93-7dae-5a50-8580-6445a08e4ae4 /
-H 'Authorization: Bearer abd90df5f27a7b170cd775abf89d632b350b7c1c9d53e08b340cd9832ce52c2c'

Regular Response

{
"data": {
"id": "0ec2de93-7dae-5a50-8580-6445a08e4ae4",
"type": "send",
"status": "pending",
"amount": {
"amount": "-1.00000000",
"currency": "BTC"
},
"native_amount": {
"amount": "-10.00",
"currency": "USD"
},
"description": null,
"created_at": "2015-01-31T20:49:02Z",
"updated_at": "2015-01-31T20:49:02Z",
"resource": "transaction",
"resource_path": "/v2/accounts/8fcd97cd-50ca-5803-8c27-1146e54b1c09/transactions/0ec2de93-7dae-5a50-8580-6445a08e4ae4",
"network": {
"status": "unconfirmed",
"hash": "a7e23afeccf863dc8359ba04d2b854eddb6dea6901643828fdb3aca53d8bf600"
},
"to": {
"resource": "user",
"id": "9d55bef5-47f1-5936-b771-b07c1d8140a2",
"resource_path": "/v2/users/9d55bef5-47f1-5936-b771-b07c1d8140a2"
}
}
}

Same Call with Expanded Resource

curl https://api.coinbase.com/v2/accounts/8fcd97cd-50ca-5803-8c27-1146e54b1c09/transactions/0ec2de93-7dae-5a50-8580-6445a08e4ae4?expand[]=to /
-H 'Authorization: Bearer abd90df5f27a7b170cd775abf89d632b350b7c1c9d53e08b340cd9832ce52c2c'

Expanded Response

{
"data": {
"id": "0ec2de93-7dae-5a50-8580-6445a08e4ae4",
"type": "send",
"status": "pending",
"amount": {
"amount": "-1.00000000",
"currency": "BTC"
},
"native_amount": {
"amount": "-10.00",
"currency": "USD"
},
"description": null,
"created_at": "2015-01-31T20:49:02Z",
"updated_at": "2015-01-31T20:49:02Z",
"resource": "transaction",
"resource_path": "/v2/accounts/8fcd97cd-50ca-5803-8c27-1146e54b1c09/transactions/0ec2de93-7dae-5a50-8580-6445a08e4ae4",
"network": {
"status": "unconfirmed",
"hash": "a7e23afeccf863dc8359ba04d2b854eddb6dea6901643828fdb3aca53d8bf600"
},
"to": {
"id": "9d55bef5-47f1-5936-b771-b07c1d8140a2",
"name": "James Smith",
"username": null,
"profile_location": null,
"profile_bio": null,
"profile_url": null,
"avatar_url": "https://images.coinbase.com/avatar?h=KphlECxEemoPGv3xtMSxqG2Ud7gEzke9mh0Ff3ifsiu9ggPwStQLCCuQfk6N%0AyY1p&s=128",
"resource": "user",
"resource_path": "/v2/users/9d55bef5-47f1-5936-b771-b07c1d8140a2"
}
}
}

Was this helpful?