---
name: submit-to-aiitem
description: Save a tool listing or community article as a private draft in aiitem. Use when someone asks to list a tool, prepare a workflow article, or send existing material to aiitem for review. The workflow returns edit and preview links for the user.
---

# Save a draft to aiitem

Use the draft API to put the user's material in their aiitem account for review.

## Set up the request

1. Set `BASE_URL` to `https://aiitem.net`.
2. Use `AIITEM_API_KEY` from the environment. If it is missing, ask the user to configure the key through a secure mechanism.
3. Pass the key in `Authorization: Bearer $AIITEM_API_KEY`. Keep the key out of URLs, logs, files, and messages.
4. See `https://aiitem.net/openapi.json` for the request and response schemas.

## Choose what to submit

- A Tool draft is a directory listing with a public product website. Describe what someone can make or do, how to get started, and what result they should expect. Use the details supplied by the user.
- A Post draft is a community article, such as a workflow walkthrough or practical tip.
- If the choice is unclear, ask a concise question. Write the draft in English and preserve the source's meaning.

## Check categories and tags

```bash
curl -fsS "${BASE_URL}/api/taxonomies?type=category"
curl -fsS "${BASE_URL}/api/taxonomies?type=tag"
```

Use slugs returned by the API. Tool drafts can use up to three categories and five tags. Include a category if you add tags. Post drafts can use one category. Leave categories or tags unset if the returned values do not fit.

## Save a tool listing

Send `name`, `website`, `description`, and `content`. Keep the description at or below 100 characters and write at least 200 readable characters for the body. HTML and Markdown formatting are excluded from the readable length. When capture is available, aiitem captures the website preview automatically. Leave image data out of the request.

```bash
curl -fsS -X POST "${BASE_URL}/api/v1/tools/drafts" \
  -H "Authorization: Bearer ${AIITEM_API_KEY}" \
  -H "Content-Type: application/json" \
  --data-binary @tool-draft.json
```

Replace the sample website and text with the user's own details. The example illustrates a listing in the design category and SVG tag.

```json
{
  "name": "Example SVG Tool",
  "website": "https://example.com",
  "description": "A sample listing for a sketch-to-SVG tool.",
  "content": "Replace this sample with a factual description of your tool. For a sketch-to-SVG workflow, explain which image formats it accepts, how to start tracing, which parts stay editable in the export, and what to check before opening the finished file in a design app.",
  "categories": ["design"],
  "tags": ["svg"]
}
```

## Save a community article

Send `title` and `content` in English. Write at least 200 readable characters in the body, using at most one link to another website. You can also send `description` and one `category` slug. Leave images and tags out of the request.

```bash
curl -fsS -X POST "${BASE_URL}/api/v1/posts/drafts" \
  -H "Authorization: Bearer ${AIITEM_API_KEY}" \
  -H "Content-Type: application/json" \
  --data-binary @post-draft.json
```

```json
{
  "title": "Check an SVG export before publishing",
  "description": "Three checks for graphics that will be reused on the web.",
  "content": "Open the exported file on light and dark backgrounds to check contrast. Zoom in to look for extra paths near the edges, then reopen the file in your design app and confirm that the shapes remain editable. Finally, test the graphic at the smallest size it will appear on the site.",
  "category": "design"
}
```

## Return the review links

1. Check for HTTP `201`, response `code: 0`, and `data.status: "draft"`.
2. Return the draft type, its title or tool name, `data.previewUrl`, and `data.editUrl`.
3. Tell the user to sign in to review the draft and publish it manually.
4. Never call a publish endpoint or report the draft as public.

## Handle request errors

- For a `400` taxonomy error, fetch the current taxonomy and retry the corrected request once.
- For `401`, ask the user to configure a valid key securely.
- For a tool `409`, tell the user the domain is already listed or submitted.
- For `413`, reduce the JSON request size.
- For `429`, wait for the time in `Retry-After` and retry once.
- For other errors, report the API message and retain the draft text for later review.
