Getting the Datadog User ID List with curl
ToC
Just a memo to myself.
There was a time when I had registered Datadog users through the console and then needed to bring them under Terraform management after the fact.
To manage them retroactively with the Terraform datadog_user resource, you need to run the following:
1 | terraform import datadog_user.this <ユーザ ID> |
But where on earth is the user ID written?!
Even when I looked at the source of the dashboard, it wasn’t there…
I was able to retrieve the user ID via the API as shown below.
1 | curl -s -X GET "https://api.datadoghq.com/api/v2/users" -H "Content-Type: application/json" -H "DD-API-KEY: xxx" -H "DD-APPLICATION-KEY: yyy" | jq -r '.data[] | .id +" "+ .attributes.handle' |
That user ID sure is long!

