Black Friday: Lấy ngay deal hời giảm 40% trọn đời!

Imagine With Craft

Use Craft’s API to Build With Claude Code

With the API switched on, your Craft docs are ready to power the apps you create. From there, you can jump into Claude Code and build something new with your doc’s data

Craft
Claude Code

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 Claude Code.

Click the “Imagine” tab in the sidebar

Step 1

Open the “Imagine” tab
Click “Add Your First API Connection” button

Step 2

Click “Add Your First API Connection”
Configure API connection settings

Step 3

Configure your API connection with a name.
Click “Add Document” button

Step 4

Click “Add Document” to select which documents this API connection has access to.
API URL displayed at the top

Step 5

The API URL that will be used to interact with your document is now displayed at the top
Click the “Download AI Bundle” button

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 Claude Code Prompt

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

In order for Claude Code 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.

Go to Claude Code

Step 1

Open a terminal on your computer. Start Claude Code in a folder which only contains the downloaded “bundle.md” file and nothing else.

Now you can add a prompt to describe the app you want to build. Here is a very general example that can be used for testing:

Please create a website that visualises the content of my connected Craft docs. You find instructions on how to access this data and its structure in the attached file.

Run the instructions

Step 2

Hit enter and wait for Claude Code to implement your app.

Some Ideas to Get You Started

Browse Examples