I do not know the default sort order, and it is not documented. In any case, the default sort order is not the same as any order that is seen in the user interface (except by chance).
If you need records in a particular order, especially if you need 100 or fewer records, I highly recommend specifying a sort order.
Yeah, this is very bizarre — my assumption above about it sorting by Record ID was wrong. And yet it also doesn’t sort by Creation Date, either.
I just tested this on a very small sample of 5 records, and this is the order of Record ID’s that it returned:
And this is the order of creation dates that it returned:
So it looks like it’s almost in alphabetical Record ID order (but it’s not), and it looks like it’s almost in creation date order (but it’s not).
So I think that the ordering must be truly random? We may want to reach out to Airtable Support to see if they know the answer to this, although the easy solution is to always specify our own sort order.
I’m not sure if @Adam_Minich is actively visiting the forums, but I’m going to tag him here to see if he has any insights on this.
I doubt that the order is truly random. Plus, if the end user actually needs a random record, I would not rely on the sort order being random. I also would not rely on the sort order being either the same or different across different calls. I prefer to think of the sort order as something more vague such as “indeterminate” or “unspecified”.
I think Scott is probably right. I just ran 10 tests with 7 records; each test used the same table but the data was entered the same after deleting the records. Random outcomes with every API request. This doesn’t mean they are reliably randomized but it does suggest if there is a pattern it is likely related to Airtable’s s storage layer and nothing specifically in the fields.
To be clear, with such a small sample size, we could predict some requests may return similar or identical orders. However, the law of large numbers tells us this would not be the case in most data sets. After further contemplation, my hunch is there is a pattern but it is likely related to how data at rest is actually recalled - perhaps a performance optimized algorithm deep inside Airtable.
I think we need a sandwich bet. :winking_face:
Nor should you care. Here’s why… integrations should exist without the influence of users who may apply various sort order changes which would create a degree of brittleness at the integration layer.
If order is what you seek, allow Airtable’s server (or your server-side code) to do it. But above all, do not create dependencies that can be abruptly changed by anything external to the integration itself.
That’s just it, there is no [apparent] sorting; it’s simply how they read the data from the storage layer. The algorithm likely has nothing to do with Airtable; more likely it has to do with the underlying database platform it all sits on and the recall performance requirements. They won’t reveal it because even they probably don’t know nor do they care to know.
My take - APIs (unless explicitly told otherwise) tend to hand you the data as fast as possible and that often means you get a tossed record salad.
You and I are on the “random” behavior. If there are others who believe it is not random, they need to bet against our horse. So far, I don’t see any takers. @Kamille_Parks?
My bet is that the current default sort order used on Nov 3, 2021 will not be documented on the support website within my lifetime. Even if a default sort order is ever documented, it will not be clear if the default sort is retroactive back to this date. Unfortunately, it will be impossible for me to win this bet.