curl --request POST \ --url https://app.getcensus.com/api/v1/sources/{source_id}/models \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "New App Users", "query": "SELECT * FROM \"users\"", "description": "Users that have signed up for our product in the last week."}'
Copy
Ask AI
{ "status": "created", "data": { "type": "model", "id": 18, "name": "New App Users", "dataset_id": 12, "description": "Users that have signed up for our product in the last week.", "query": "SELECT * FROM \"users\"", "created_at": "2021-10-20T02:43:07.120Z", "updated_at": "2021-10-20T02:50:35.477Z", "compiled_query": null, "columns": [ { "name": "user_id", "type": "character varying (256)" }, { "name": "full_name", "type": "character varying (256)" } ], "dataset_id=": 12, "source_object_id": 20 }}
Models
Create a new model
⚠️ DEPRECATED: This endpoint is deprecated and will be removed in a future version.
Please migrate to the new Datasets API instead.
POST
/
sources
/
{source_id}
/
models
Create a new model
Copy
Ask AI
curl --request POST \ --url https://app.getcensus.com/api/v1/sources/{source_id}/models \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "New App Users", "query": "SELECT * FROM \"users\"", "description": "Users that have signed up for our product in the last week."}'
Copy
Ask AI
{ "status": "created", "data": { "type": "model", "id": 18, "name": "New App Users", "dataset_id": 12, "description": "Users that have signed up for our product in the last week.", "query": "SELECT * FROM \"users\"", "created_at": "2021-10-20T02:43:07.120Z", "updated_at": "2021-10-20T02:50:35.477Z", "compiled_query": null, "columns": [ { "name": "user_id", "type": "character varying (256)" }, { "name": "full_name", "type": "character varying (256)" } ], "dataset_id=": 12, "source_object_id": 20 }}
The identifier for the dataset that corresponds to this model. A model will always have a corresponding dataset unless the model belongs to a dbt, looker, sigma recipe that has not been used in Census