---
# System prepended metadata

title: Story Partner API Documentation

---

# Story Partner API Documentation

## Overview
The Story Partner API provides endpoints for managing story partner interactions and user task management. Built with Elysia.js, it includes Swagger documentation and implements secure API key authentication.

## API Base URL
https://partner-api-production.up.railway.app/

## Swagger Documentation

Swagger UI is available at `/swagger` endpoint.

## Authentication
All protected endpoints require an API key to be included in the request headers:
```
x-partner-api-key: YOUR_API_KEY
```

## API Endpoints

### Health Check
GET /

Checks if the API is running and healthy.

**Response**
```json
{
  "status": 200,
  "message": "Story Partner API!"
}
```

### Create User Task
POST /postUserTask

Creates or updates a task for a specific user identified by their wallet address.

**Request Headers**
```
x-partner-api-key: YOUR_API_KEY
Content-Type: application/json
```

**Request Body**
```json
{
  "walletAddress": "0x1234...", // 42 characters long Ethereum address
  "task": "string"              // Task description
}
```

**Validation Rules**
- `walletAddress`: Must be a valid Ethereum address (0x followed by 40 hexadecimal characters)
- `task`: Cannot be empty

**Success Response (200)**
```json
{
  "status": 200,
  "message": "Task stored successfully"
}
```

**New User Creation Response (200)**
```json
{
  "status": 200,
  "message": "New user created and task stored successfully"
}
```

**Duplicate Task Response (200)**
```json
{
  "status": 200,
  "message": "Task already exists"
}
```

**Bad Request Response (400)**
```json
{
  "status": 400,
  "message": "Failed to store task",
  "error": "Error message details"
}
```

**Server Error Response (500)**
```json
{
  "status": 500,
  "message": "Internal Server Error",
  "error": "Error message details"
}
```

## Database Schema

### User Document
```typescript
interface User {
  walletAddress: string;
  tasks: Array<{
    projectId: string;
    task: string;
    createdAt: Date;
  }>;
  createdAt: Date;
  lastUpdatedAt: Date;
}
```