---
title: "Create a named source"
method: POST
path: "/v3/named-sources"
tags: ["Named Sources"]
---

# Create a named source

`POST /v3/named-sources`

Creates a named source — an alias for a SQL query that you can reference
from the Maps and SQL APIs without exposing the query itself.

## Request body

- object
  - `name` string, required — Lowercase alphanumerics, hyphens and underscores. Must start with a letter or digit, must not end with a hyphen or underscore, and must be 3 to 51 characters long.
  - `source` string, required — The SQL query this name resolves to.

## Response `200`

The named source was created.

- NamedSource
  - `name` string
  - `source` string
  - `accountId` string
  - `userId` string
  - `createdAt` string
  - `updatedAt` string

## Other responses

- `400` — The request is malformed or a parameter failed validation.
- `401` — The token is missing, malformed or expired.

---

[API](https://skmtc.net/gitbookio/apis/carto-api.md) · [All operations](https://skmtc.net/gitbookio/apis/carto-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/gitbookio/carto-api/revisions/019f79ecdd6c/schema)
