I am trying to figure out how to use the ExactTarget SOAP API to retrieve the number of records in a DataExtensionObject for a given DataExtensionObject key, for example:


I don't need to retrieve all fields from the data extension (I'm already doing this), I just want to count the number of records/rows. Does anyone know how to do this?

2 Answers 2


You can retrieve rows count using an undocumented REST endpoint:

GET https://YOUR-HOST.rest.marketingcloudapis.com/data/v1/customobjectdata/key/<DE-KEY>/rowset?$page=1&$pagesize=1
  "links": {
    "self": "/v1/customobjectdata/token/100e08a6-6e2d-4e33-9e10-0bf30fc9ebc7/rowset?$page=1",
    "next": "/v1/customobjectdata/token/100e08a6-6e2d-4e33-9e10-0bf30fc9ebc7/rowset?$page=2"
  "requestToken": "100e08a6-6e2d-4e33-9e10-0bf30fc9ebc7",
  "tokenExpireDateUtc": "2020-10-09T12:44:32.51",
  "customObjectId": "<DE-ID>",
  "customObjectKey": "<DE-KEY>",
  "pageSize": 1,
  "page": 1,
  "count": 636,
  "items": [
      "keys": {
        "email": "[email protected]"
      "values": {
        "client_id": "ABCDEFGHUJKLMNOPQ",
        "country": "",
        "foo": "",
        "bar": ""

I actually just went through this - and unfortunately, there isn't a direct way to get a record count.

However - there is a workaround

You can create a QueryActivity and create a counts data extensions using a query similar to this -

"SELECT COUNT(YOUR_DE.Email) as Count, "Emails" as DE_NAME FROM YOUR_DE"

The QueryActivity would point at your counts de with two columns count and DE_NAME. You can then hook up multiple queries in one shot and get a count of all your tables. You would then retrieve the data in the count table (after running the query) and determine the number of records.

This is in no way ideal, however it's currently the best approach I can see until we have the routes built out for it.

  • Why wouldn't an ampscript Rowcount() work here?
    – Jonny Shaw
    Commented Jun 4, 2014 at 19:04
  • @jonnyshaw This is with the SOAP API, not AMPscript Commented Jun 4, 2014 at 19:06
  • A year and a half past since this answer. Is there a simpler way to retrieve the row count? The biggest problem with the current approach is that the query goes into a queue and you sometimes have to wait a long time to get this simple row count..
    – Yoni Baciu
    Commented Nov 13, 2015 at 1:04
  • Yes. I realize that it sucks. No clue if they have changed it. I stopped using the product 7 months ago. Commented Nov 13, 2015 at 1:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .