Models

get
Get Models by Project

https://app.fuchsiacms.com/api/models/project/:projectId
This endpoint allows you to get all models inside a project
Request
Response
Request
Path Parameters
projectId
required
string
ID of the project in which you would like the models
Query Parameters
skip
optional
integer
The amount of models to skip. Works well with take query param to create pagination. Default 0
take
optional
integer
The amount of models to return. Default 20
search
optional
string
Filter the models by their name
key
required
string
The API key for the project
Response
200: OK
List of models
[
{
id: "string",
projectId: "string",
name: "string",
description: "string",
fieldDisplayCode: "string",
fields: [
{
codeName: "string",
displayName: "string",
kind: "shortText | richText | markdown | html | json | number | boolean | media | color | date | time | choice | location | reference | template",
order: "int",
isRequired: "boolean",
isList: "boolean",
defaultValue: "*",
options: {
choiceOptions?: {
choices: ["string"]
},
markdownOptions?: {
autoHeadingIds: "boolean"
},
referenceOptions?: {
modelId: "string"
}
}
}
],
createdAt: "int64",
updatedAt: "int64"
}
]
400: Bad Request
Malformed request
"message"
401: Unauthorized
Invalid API key
"Invalid API key"

get
Get Model

https://app.fuchsiacms.com/api/models/model/:modelId
Get one model
Request
Response
Request
Path Parameters
modelId
required
string
The ID of the model to retrieve
Query Parameters
key
required
string
The API key of the project that holds that model
Response
200: OK
Model object
{
id: "string",
projectId: "string",
name: "string",
description: "string",
fieldDisplayCode: "string",
fields: [
{
codeName: "string",
displayName: "string",
kind: "shortText | richText | markdown | html | json | number | boolean | media | color | date | time | choice | location | reference | template",
order: "int",
isRequired: "boolean",
isList: "boolean",
defaultValue: "*",
options: {
choiceOptions?: {
choices: ["string"]
},
markdownOptions?: {
autoHeadingIds: "boolean"
},
referenceOptions?: {
modelId: "string"
}
}
}
],
createdAt: "int64",
updatedAt: "int64"
}
400: Bad Request
Malformed Request
"message"
401: Unauthorized
Invalid API key
"Invalid API key"

post
Create Model

https://app.fuchsiacms.com/api/models/model
Create a new model
Request
Response
Request
Query Parameters
key
required
string
The API key of the project that the model will be inserted into.
Body Parameters
fields
optional
array
List of fields to include in the model. Scroll below to see a field structure.
fieldDisplayCode
required
string
The codeName of one the fields defined in the fields body parameter.
description
optional
string
Description of the new model
name
required
string
Name of the new model
projectId
required
string
The ID of the project that the model will be inserted into.
Response
200: OK
Returns the newly created Model
{
id: "string",
projectId: "string",
name: "string",
description: "string",
fieldDisplayCode: "string",
fields: [
{
codeName: "string",
displayName: "string",
kind: "shortText | richText | markdown | html | json | number | boolean | media | color | date | time | choice | location | reference | template",
order: "int",
isRequired: "boolean",
isList: "boolean",
defaultValue: "*",
options: {
choiceOptions?: {
choices: ["string"]
},
markdownOptions?: {
autoHeadingIds: "boolean"
},
referenceOptions?: {
modelId: "string"
}
}
}
],
createdAt: "int64",
updatedAt: "int64"
}
400: Bad Request
Malformed Request
"message"
401: Unauthorized
Invalid API key
"Invalid API key"

A field structure for the above request:

{
codeName: "string",
displayName: "string",
kind: "shortText | richText | markdown | html | json | number | boolean | media | color | date | time | choice | location | reference | template",
order: "int",
isRequired: "boolean",
isList: "boolean",
defaultValue: "*",
options: {
choiceOptions?: {
choices: ["string"]
},
markdownOptions?: {
autoHeadingIds: "boolean"
},
referenceOptions?: {
modelId: "string"
}
}
}

patch
Modify Model

https://app.fuchsiacms.com/api/models/model
Request
Response
Request
Query Parameters
key
required
string
The project API key
Body Parameters
fields
required
array
List of field objects. See above for example of field structure
fieldDisplayCode
required
string
The codeName of one of the fields in the fields body param
description
optional
string
The description of the model
name
required
string
The name of the model
id
required
string
The model ID
Response
200: OK
Count of records modified
1
400: Bad Request
Malformed request
"message"
401: Unauthorized
Invalid API key
"Invalid API key"

delete
Delete Model

https://app.fuchsiacms.com/api/models/model/:modelId
WARNING: Deleting a model is a destructive operation and will also delete all collections and records associated with the model. This is irreversible.
Request
Response
Request
Path Parameters
modelId
required
string
ID of the model to delete
Query Parameters
key
required
string
Project API key
Response
200: OK
Returns the ID of the successfully deleted model
"<Model ID>"
400: Bad Request
Malformed Request
"message"
401: Unauthorized
Invalid API key
"Invalid API Key"