Quick Start
Create a ProjectEdit a PageLink to a PageSet a TemplatePrepare for SEOPublish to the WebSet up a Custom DomainBasics
Project StructureMarkdownJSXMDXMarkdocES ModulesCSS StylingTailwind CSSMetadataLayout and Design
LayoutsTemplatesResponsive DesignsUsing ColorsTypographyMathematicsPublishing
SEO and SharingCustom DomainsAnalyticsSitemapsFaviconsGuides
WebflowNotionFramerConfiguration
motif.jsontailwind.config.jsmain.cssApp
Keyboard ShortcutsSlash CommandsInstant SearchOffline AccessDistraction-Free WritingReal-Time CollaborationDesktop AppAdvanced
Motif APIAn introductory guide to querying the Motif API.
The Motif Platform API gives you access to the Motif platform, such as projects and pages, via a simple HTTP endpoint.
With the exception of the pages endpoint, API requests must provide a bearer token in the Authorization header:
Authorization: Bearer <TOKEN>
To obtain a token, head over to the space settings, select the "Development" tab, and hit "Create token".
Your tokens can perform API requests to your space's projects and pages without restrictions. Make sure to keep your tokens confidential and only store them on your own servers. Do not share your tokens with third parties. If you believe a token has been compromised, you can revoke it at any time.
With the exception of the pages endpoint, API requests must be encoded with the Content-Type: application/json
header. Responses are likewise encoded as JSON. For the pages endpoint, the response is an ES module, and the response type is application/javascript
.
GET /v1/projects
Get a list of the projects under your space.
curl "https://api.motif.land/v1/projects" \
-H "Authorization: Bearer <TOKEN>"
{
"data": {
"projects": [
{
"id": "588225479998964038",
"name": "A project name",
"domain": "a-project-domain",
"spaceId": "829599843919566672"
},
{
"id": "878977683429979945",
"name": "Another project name",
"domain": "another-project-domain",
"spaceId": "829599843919566672"
}
]
}
}
GET /v1/projects/:id
Get the information for a single project, including all files and folders.
curl "https://api.motif.land/v1/projects/a-project-id" \
-H "Authorization: Bearer <TOKEN>"
{
"data": {
"id": "306116510530667073",
"files": [
{
"id": "306116511297176129",
"updatedAt": 1628197589450,
"name": "motif.json",
"isPublic": null,
"parent": "",
"meta": {},
"fileType": "json"
},
{
"id": "306116511297177153",
"updatedAt": null,
"name": "tailwind.config.js",
"isPublic": null,
"parent": "",
"meta": {},
"fileType": "js"
},
{
"id": "306116511297178177",
"updatedAt": null,
"name": "main.css",
"isPublic": null,
"parent": "306116511023500865",
"meta": {},
"fileType": "css"
},
{
"id": "306116511297185345",
"updatedAt": 1628208302402,
"name": "Index",
"isPublic": null,
"parent": "306116511023499841",
"meta": {
"title": "Motif",
"date": "2021-08-05"
},
"fileType": "mdx"
}
],
"folders": [
{
"id": "306116511023497793",
"updatedAt": null,
"name": "components",
"projectId": "306116510530667073",
"parent": ""
},
{
"id": "306116511023498817",
"updatedAt": null,
"name": "templates",
"projectId": "306116510530667073",
"parent": ""
},
{
"id": "306116511023499841",
"updatedAt": null,
"name": "pages",
"projectId": "306116510530667073",
"parent": ""
},
{
"id": "306116511023500865",
"updatedAt": null,
"name": "styles",
"projectId": "306116510530667073",
"parent": ""
}
]
}
}
This endpoint does not require authentication.
GET /v1/pages/esm/:id
Get a page as an ES module.
curl "https://api.motif.land/v1/pages/esm/a-page-id"
import React from "https://cdn.skypack.dev/react"
export const _meta = {
title: "Motif",
date: "2022-07-01",
}
function MDXContent(props) {
const _components = Object.assign(
{
p: "p",
},
props.components
),
{ wrapper: MDXLayout } = _components
const _content = /*#__PURE__*/ React.createElement(
React.Fragment,
null,
/*#__PURE__*/ React.createElement(_components.p, null, "Welcome to Motif!")
)
return MDXLayout
? /*#__PURE__*/ React.createElement(MDXLayout, props, _content)
: _content
}
export default MDXContent
let __meta = {}
if (typeof _meta !== "undefined") {
__meta = { ...__meta, ..._meta }
}
export const meta = __meta
export const filename = "index"
This endpoint is intended to be used for ES module imports. So using the same URL, you can embed page content into your existing JavaScript projects. For instance:
import Page, { meta } from "https://api.motif.land/v1/pages/esm/a-page-id"
const Component = () => {
console.log("Meta", JSON.stringify(meta))
return <Page />
}
export default Component
© 2022 Motif Land Inc. All rights reserved. This site is built with Motif.