POST
/
sources
/
{source_id}
/
models
curl --request POST \
  --url https://app.getcensus.com/api/v1/sources/{source_id}/models \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "description": "Users that have signed up for our product in the last week.",
  "name": "New App Users",
  "query": "SELECT * FROM \"users\""
}'
{
  "data": {
    "columns": [
      {
        "name": "user_id",
        "type": "character varying (256)"
      },
      {
        "name": "full_name",
        "type": "character varying (256)"
      }
    ],
    "compiled_query": "null",
    "created_at": "2021-10-20T02:43:07.120Z",
    "description": "Users that have signed up for our product in the last week.",
    "id": 18,
    "name": "New App Users",
    "query": "SELECT * FROM \"users\"",
    "source_object_id": 20,
    "type": "model",
    "updated_at": "2021-10-20T02:50:35.477Z"
  },
  "status": "created"
}

Authorizations

Authorization
string
headerrequired

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

source_id
integer
required

ID of the source

Body

application/json
description
string

The description for this model.

name
string
required

The name of this model.

query
string
required

The SQL query associated with this model.

Response

201 - application/json
data
object
status
enum<string>

Outcome of the operation.

Available options:
success,
updated,
created,
not_found,
error