# API Creation

Creating an API with PromptJoy is as simple as describing what you want it to do. Let's go through the process using an example: creating a book search API.

### Step 1: Describe Your API

To create a new API, begin by describing what you want it to do. For our example, you might say: "You are a book search engine. I will give you a query, and you will give me 3 results, each one of a real book."

### Step 2: Define the Input and Output

Next, define what the input and output of the API should look like. This is how we tell the API what data it should expect and what it should return. For our book search API, the input might be a query string, and the output could be a list of books.

Input

```json
{"query":"running"}
```

Output

```json
[
  {"title": "Daniels' Running Formula", "author":"Jack Daniels"},
  {"title": "Running In The Dark- Autobiography: To exist on this spinning planet means hope", "author":"Senol Tasdelen"},
  {"title": "80/20 Running: Run Stronger and Race Faster by Training Slower", "author":"Matt Fitzgerald, Rob Grgach, et al."}
]

```

### Step 3: Create Your API

With the description, input, and output defined, you can now create your API. Click on the "Create API" button and PromptJoy will do the rest. Your API is now ready to use.

### Step 4: Test Your API

Once your API is created, you can test it right within PromptJoy. Just enter your query, hit "Test", and you'll see the results instantly.

And that's it! You've just created a book search API with PromptJoy. With this API, you can now search for books in your application.

The same process applies to creating other APIs as well. Just describe what you want, define the input and output, and let PromptJoy create the API for you.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.promptjoy.com/api/api-creation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
