# Ghost Integration via LowCodeAPI

## Overview

Ghost is a modern publishing platform for creating and monetizing content through blogs, newsletters, and subscription-based publications. The Ghost Admin API allows you to manage posts, pages, tags, authors, images, and more programmatically.

## Base Endpoint

```
https://api.lowcodeapi.com/ghost/
```

## Authentication

LowCodeAPI handles authentication automatically. You only need to:

1. **Sign up** at [Ghost](https://ghost.org)
2. **Create a Ghost site** and get your Admin API Key
3. **Connect your account** in LowCodeAPI dashboard
4. **Use your `api_token`** in all requests

The `api_token` is your LowCodeAPI authentication token. LowCodeAPI will automatically:
- Fetch your Ghost endpoint and API key from the database
- Apply authentication to each request

**Auth Type**: API Key (Ghost Admin API)

**Credential Link**: [https://ghost.org/docs/admin-api/#authentication](https://ghost.org/docs/admin-api/#authentication)

## API Categories

- **Content Management** - Content management systems and publishing platforms

## Common Endpoints

### Category: Admin/Images

#### Upload Image

**Method**: `POST` | **LowCodeAPI Path**: `/admin/images/upload`

**Full URL**:
```
https://api.lowcodeapi.com/ghost/admin/images/upload?api_token={api_token}
```

**Description**: Upload an image to your Ghost site

**Query Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `api_token` | string | Yes | Your LowCodeAPI authentication token |

**Body Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `file` | file | Yes | Image file to upload |
| `purpose` | string | No | Image purpose (image, profile_image, etc.) |

**Example Request**:
```bash
curl -X POST "https://api.lowcodeapi.com/ghost/admin/images/upload?api_token=YOUR_API_TOKEN" \
  -H "Content-Type: multipart/form-data" \
  -F "[email protected]" \
  -F "purpose=image"
```

**Official Documentation**: [https://ghost.org/docs/admin-api/#the-image-object](https://ghost.org/docs/admin-api/#the-image-object)

---

### Category: Admin/Posts

#### Create Post

**Method**: `POST` | **LowCodeAPI Path**: `/admin/posts`

**Full URL**:
```
https://api.lowcodeapi.com/ghost/admin/posts?api_token={api_token}
```

**Description**: Create a new blog post

**Query Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `api_token` | string | Yes | Your LowCodeAPI authentication token |

**Body Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `posts` | array | Yes | Array of post objects to create |
| `title` | string | No | Post title |
| `content` | string | No | Post content in HTML or markdown |
| `status` | string | No | Post status (draft, published, etc.) |

**Example Request**:
```bash
curl -X POST "https://api.lowcodeapi.com/ghost/admin/posts?api_token=YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "posts": [{
      "title": "My First Post",
      "content": "This is the post content",
      "status": "draft"
    }]
  }'
```

**Official Documentation**: [https://ghost.org/docs/admin-api/#posts](https://ghost.org/docs/admin-api/#posts)

---

#### Read Posts

**Method**: `GET` | **LowCodeAPI Path**: `/admin/posts`

**Full URL**:
```
https://api.lowcodeapi.com/ghost/admin/posts?api_token={api_token}
```

**Description**: List all posts on your Ghost site

**Query Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `limit` | number | No | Number of posts to return |
| `page` | number | No | Page number for pagination |
| `api_token` | string | Yes | Your LowCodeAPI authentication token |

**Example Request**:
```bash
curl -X GET "https://api.lowcodeapi.com/ghost/admin/posts?limit=10&api_token=YOUR_API_TOKEN"
```

**Official Documentation**: [https://ghost.org/docs/admin-api/#posts](https://ghost.org/docs/admin-api/#posts)

---

### Category: Admin/Tags

#### Create Tag

**Method**: `POST` | **LowCodeAPI Path**: `/admin/tags`

**Full URL**:
```
https://api.lowcodeapi.com/ghost/admin/tags?api_token={api_token}
```

**Description**: Create a new tag for organizing content

**Query Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `api_token` | string | Yes | Your LowCodeAPI authentication token |

**Body Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `tags` | array | Yes | Array of tag objects to create |
| `name` | string | No | Tag name |
| `slug` | string | No | URL slug for the tag |
| `description` | string | No | Tag description |

**Example Request**:
```bash
curl -X POST "https://api.lowcodeapi.com/ghost/admin/tags?api_token=YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "tags": [{
      "name": "Technology",
      "slug": "technology",
      "description": "Posts about technology"
    }]
  }'
```

**Official Documentation**: [https://ghost.org/docs/admin-api/#tags](https://ghost.org/docs/admin-api/#tags)

---

## Usage Examples

### Example 1: Publish a Blog Post

This example shows how to create and publish content:

```bash
# Step 1: Upload a featured image
# No ID required - uploads a new image
curl -X POST "https://api.lowcodeapi.com/ghost/admin/images/upload?api_token=YOUR_API_TOKEN" \
  -H "Content-Type: multipart/form-data" \
  -F "[email protected]"

# Step 2: Create a new post
# No ID required - creates a new post and returns post ID
curl -X POST "https://api.lowcodeapi.com/ghost/admin/posts?api_token=YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "posts": [{
      "title": "Getting Started with Ghost",
      "content": "<p>This is my first post using the Ghost API.</p>",
      "status": "published"
    }]
  }'

# Step 3: Read all posts
# No ID required - lists all posts with pagination
curl -X GET "https://api.lowcodeapi.com/ghost/admin/posts?limit=20&api_token=YOUR_API_TOKEN"
```

### Example 2: Organize Content with Tags

```bash
# Step 1: Create tags
# No ID required - creates new tags
curl -X POST "https://api.lowcodeapi.com/ghost/admin/tags?api_token=YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "tags": [
      {"name": "Tutorial"},
      {"name": "News"}
    ]
  }'

# Step 2: Create a post with tags
# No ID required - creates post with tag association
curl -X POST "https://api.lowcodeapi.com/ghost/admin/posts?api_token=YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "posts": [{
      "title": "API Tutorial",
      "tags": [{"name": "Tutorial"}]
    }]
  }'
```

## Complete Endpoint Reference

For a complete list of all endpoints and their parameters, refer to:
- **OpenAPI Definition**: `https://backend.lowcodeapi.com/ghost/definition`
- **Official Provider Documentation**: [https://ghost.org/docs/admin-api/](https://ghost.org/docs/admin-api/)

## Rate Limits & Best Practices

- Ghost has **API rate limits** based on your plan
- **Best practice**: Implement pagination for large content sets
- **Best practice**: Use draft status for posts before publishing
- **Best practice**: Optimize images before uploading

## Error Handling

Standard HTTP status codes apply