Writing
Plural or Singular? Naming API Endpoints and Database Tables
Use plural nouns for collection endpoints, because the major API style guides agree. Tables have no standard, so follow your framework, pick one, and enforce it. Reserved words are the one real technical argument.
By Ka Lun Chan · Architecture / Engineering judgment
Should API endpoints and database tables be plural or singular?
Use plural nouns for collection endpoints: /customers for the list and /customers/42 for one customer. The major API style guides agree on that. Tables have no standard, so follow your framework’s default, or pick one and enforce it. If you’re starting with no default, plural tables avoid reserved-word clashes and match the endpoints.
Most of the debate is about convention, not correctness. Three things are worth knowing:
- For endpoints there’s a clear published consensus, so following it saves an argument.
- For tables the frameworks themselves disagree, and that’s the strongest reason to follow yours.
- The one hard technical constraint is reserved words, and it favors plural or prefixed table names.
| Layer | Name | Rule |
|---|---|---|
| Collection endpoint | /customers | Plural. The guides agree. |
| Item endpoint | /customers/42 | The same plural segment plus an ID |
| Nested collection | /customers/42/orders | Plural at every collection level |
| Singleton | /user or /me | Singular. There’s one per caller. |
| Table | customers or customer | Team decision. Follow the framework, avoid reserved words. |
| ORM class | Customer | Singular. One instance is one row. |
| Foreign key | customer_id | Singular. It points at one row. |
Why should REST endpoints be plural?
Because a collection endpoint returns many items and an item endpoint is one member of that collection. Plural nouns keep both under one path, and the published guidelines from Microsoft, Google and Zalando all require or recommend it.
The guidance is unusually consistent:
- Microsoft’s web API design guidance says to use plural nouns for collection URIs, with
/customersand/customers/5as its example. - Google’s AIP-122 says collection identifiers must be the plural form of the noun, and allows the singular only where a word has no plural.
- Zalando’s RESTful API guidelines make it a rule: must pluralize resource names.
Public APIs follow suit. Stripe uses /v1/customers and /v1/customers/:id. The practical benefit is one pattern for the list, the item and anything nested under it, so a client developer can guess the next URL correctly.
The exception is a resource that exists once per caller. GitHub’s API has GET /users/{username} for any user and GET /user for the signed-in one. That singular path is deliberate, because there’s no collection to index into. A /me endpoint or an account’s single settings resource works the same way.
Should database table names be plural or singular?
There’s no standard, and the major frameworks split. Rails and Laravel default to plural table names. Django’s default is singular. Prisma recommends singular model names. Follow your framework, and if it has no default, choose once and write it down.
Plural supporters say a table holds many rows, so SELECT * FROM customers reads naturally and the table matches the endpoint. The singular camp says a table defines one kind of entity, so it should match the class that represents one row, and joins read as customer.id = invoice.customer_id.
The frameworks you’re likely to use don’t settle it:
- Rails pluralizes the class name, so
Bookmaps tobooks. - Laravel’s Eloquent uses the snake case plural of the class, so
Flightmaps toflights. - Django joins the app label to the model name, so
Bookin thebookstoreapp becomesbookstore_book. - Prisma notes that plural snake_case tables are common, recommends singular PascalCase models, and maps between them with
@@map. - SQLAlchemy uses the
__tablename__you set. Its own examples are singular.
So the claim that frameworks default to plural is only half true. For a Python team on Django, singular is the path of least resistance. For a FastAPI and SQLAlchemy team, it’s a free choice, which is exactly when a written convention earns its keep.
Why is user a bad table name?
Because USER is a reserved word in PostgreSQL and SQL Server, so a table called user must be quoted in every query. ORDER and GROUP are reserved in both too. Plural names such as users, orders and groups don’t clash.
PostgreSQL’s keyword list marks USER, ORDER and GROUP as reserved, which it defines as not allowed as table or column names. SQL Server’s reserved keywords include USER, TRANSACTION, ORDER and GROUP, usable only as delimited identifiers.
-- PostgreSQL: USER is reserved, so this fails
CREATE TABLE user (id bigint PRIMARY KEY);
-- Quoting works, but every query has to remember the quotes
CREATE TABLE "user" (id bigint PRIMARY KEY);
SELECT * FROM "user";
-- Plural (or a prefix) avoids the problem
CREATE TABLE users (id bigint PRIMARY KEY);Quoting works until someone writes a migration, a report or an ad hoc query without the quotes. ORMs quote for you, which hides the problem until the first hand-written SQL. Many of the entities every app has, such as users, orders, groups and transactions, are exactly the ones that collide. That’s the closest thing to a technical argument in this debate. If your team prefers singular names, prefix the colliding ones, as SQLAlchemy’s own example does with user_account.
Do the table and the endpoint need the same name?
No. The endpoint is a contract with clients and the table is an implementation detail. The ORM and the API layer map between them, so each layer can follow its own rule.
In a React and Python stack, the class is singular because one instance is one row, the table follows your convention, and the URL is plural because that’s what API clients expect:
# SQLAlchemy: the class is singular, the table is whatever you decide
class Customer(Base):
__tablename__ = "customers"
id: Mapped[int] = mapped_column(primary_key=True)
# FastAPI: the URL is plural regardless of the table name
router = APIRouter(prefix="/customers")
@router.get("/{customer_id}")
def get_customer(customer_id: int) -> CustomerOut: ...That separation matters more than the naming itself. Endpoints that mirror table names make the database schema part of the public contract, so a table rename becomes a breaking API change. As I wrote in do you need a UI mockup before building the backend, the API should be shaped by what clients need and the schema by the domain. Names are one more place to keep those apart.
On the React side, the client mostly sees the URL and the JSON. Keep the JSON field names consistent too. Google’s AIP-122 uses camelCase for collection identifiers and Zalando requires snake_case for property names, which shows again that picking one matters more than which one.
How do you keep naming consistent across a team?
Write the convention down where people make the change, check it automatically where you can, and apply it to new names without renaming old ones. A mixed codebase with a clear rule for new work is better than a risky rename.
- Write it down once, in the repository: plural collection paths, the table rule, foreign keys as
entity_id, field casing, and the list of words to avoid. - Check endpoints in CI. An OpenAPI linter can flag collection paths that aren’t plural, so the rule doesn’t depend on reviewers remembering it.
- Review migrations for names as well as correctness. A new table is the cheapest moment to get the name right.
- Leave existing names alone unless you’re changing that code anyway. Renaming a live table touches every query, migration, report and dashboard, and renaming an endpoint breaks its clients. Map names in the ORM or the API layer instead.
If you inherit a system with both styles, the rule is the same: match whatever the surrounding code does, and use the written convention for anything new.
Sources
Checked in November against Microsoft, Google and Zalando’s API guidelines, JSON:API, Stripe and GitHub’s API references, the Rails, Laravel, Django, Prisma and SQLAlchemy documentation, and the PostgreSQL and SQL Server keyword lists. The table, the examples and the recommendations are mine.
- Microsoft Azure Architecture Center: Web API design best practices
- Google AIP-122: Resource names
- Zalando RESTful API Guidelines (rule 134: pluralize resource names)
- JSON:API: Recommendations
- Stripe API reference: Customers
- GitHub Docs: REST API endpoints for users
- Ruby on Rails Guides: Active Record Basics
- Laravel Docs: Eloquent table names
- Django Docs: Model Meta options (db_table)
- Prisma Docs: Database mapping
- SQLAlchemy 2.0 Docs: ORM Quick Start
- PostgreSQL Docs: SQL Key Words
- Microsoft Learn: Reserved Keywords (Transact-SQL)
Short answers
Should REST API endpoints be plural or singular?
Plural for collections. Microsoft’s API design guidance, Google’s AIP-122 and Zalando’s API guidelines all say to use plural nouns, so /customers is the collection and /customers/42 is one customer. Resources that exist once per caller, such as the signed-in user, can stay singular.
Should database table names be plural or singular?
There is no standard, and both are common. Rails and Laravel default to plural table names, while Django’s default is the app label plus the model name, which is singular. Follow your framework’s default if it has one, otherwise pick one, write it down and apply it everywhere.
Why is user a bad table name?
USER is a reserved word in PostgreSQL and SQL Server, so a table called user has to be quoted in every query. ORDER and GROUP are reserved in both as well. Plural names such as users, orders and groups avoid the problem, as do prefixed names such as app_user.
Should I rename existing tables or endpoints to fix the naming?
Usually not. Renaming a live table touches every query, migration and report, and renaming an endpoint breaks its clients. Keep the existing convention, apply the rule to new names, and map names in the ORM or API layer where they differ.
Settle it once
Pick the rule in the first week, put it in the repository and let CI enforce the parts it can. Ten minutes of agreement saves the same naming argument in every review that follows.