Imagine With Craft

Use Craft’s API to Build With Craft Agents

Use Craft's API to build apps on Craft Agents. Fetch your documents, sync content, and create custom tools powered by your Craft data.

Craft
Craft Agents

Enabling the API for Documents

First, you have to enable the API in order for Craft to setup an API endpoint for your documents. Then, you use the API endpoint URL to connect to the server from Craft Agents.

Step 1

Open the “Imagine” tab

Step 2

Click “Add Your First API Connection”

Step 3

Configure your API connection with a name.

Step 4

Click “Add Document” to select which documents this API connection has access to.

Step 5

The API URL that will be used to interact with your document is now displayed at the top

Step 6

Click the “Download AI Bundle” button. This will download a folder containing the API documentation and the content of your doc.

Using the API in a Craft Agents Prompt

Once the API is enabled for your Craft docs, you can now focus on writing a prompt that Craft Agents will use to generate your project.

In order for Craft Agents to see how to use the API and understand the structure of your document, you attach the AI bundle to your prompt. This bundle is a markdown document that contains the current content of your Craft doc as well as the API documentation.

Step 1

Öffnen Sie Craft Agents und navigieren Sie in der Seitenleiste zu „Quellen“. Klicken Sie auf „Quelle hinzufügen“ oder auf die Schaltfläche „+“, um zu beginnen.

Step 2

Fügen Sie im Chat-Eingabefeld die API-Endpunkt-URL ein. Zum Beispiel: „Verbinden mit https://api.craft.do/...“. Der Agent erledigt den Rest automatisch.

Step 3

Der Agent erstellt die Quellkonfiguration, richtet Berechtigungen ein und validiert die Verbindung mit der Craft-API.

Step 4

Wählen Sie auf der Craft-Autorisierungsseite den Bereich aus, den Sie verbinden möchten, und klicken Sie auf „Genehmigen“. Ihr Agent ist nun verbunden und einsatzbereit.

Some Ideas to Get You Started

Browse Examples