Skip to content

Latest commit

 

History

History
244 lines (221 loc) · 4.39 KB

APIEndPoints.md

File metadata and controls

244 lines (221 loc) · 4.39 KB

SponsoHive API Endpoints

Authentication

1. User Registration

POST /api/auth/register

  • Description: Register a new user.
  • Request Body:
    {
      "username": "string",
      "email": "string",
      "password": "string"
    }
  • Response:
    {
      "message": "User registered successfully",
      "userId": "string"
    }

2. User Login

POST /api/auth/login

  • Description: Authenticate a user.
  • Request Body:
    {
      "email": "string",
      "password": "string"
     }
  • Response:
    {
      "token": "string",
      "user": {
        "id": "string",
        "username": "string",
        "email": "string"
      }
    }

3. User Logout

POST /api/auth/logout

  • Description: Log out a user.
  • Headers:
    • Authorization: Bearer <token>
  • Response:
    {
      "message": "Logout successful"
    }

Email List Management

4. Upload Email List

POST /api/emails/upload

  • Description: Upload a bulk email list.
  • Headers:
    • Authorization: Bearer <token>
  • Request Body:
    {
      "file": "<CSV/Excel file>"
    }
  • Response:
    {
      "message": "Emails uploaded successfully",
      "processed": "integer",
      "duplicates": "integer",
      "invalid": "integer"
    }

5. Get Email List

GET /api/emails

  • Description: Retrieve all uploaded emails.
  • Headers:
    • Authorization: Bearer <token>
  • Response:
    [
      {
        "email": "string",
     "category": "string",
        "status": "valid | duplicate | invalid"
      }
    ]

6. Delete Email

DELETE /api/emails/:emailId

  • Description: Delete an email from the list.
  • Headers:
    • Authorization: Bearer <token>
  • Response:
    {
      "message": "Email deleted successfully"
    }

Campaign Management

7. Create Campaign

POST /api/campaigns

  • Description: Create a new email campaign.
  • Headers:
    • Authorization: Bearer <token>
  • Request Body:
    {
      "name": "string",
      "emails": ["string"],
      "template": "string",
     "schedule": "ISO_8601 string"
    }
  • Response:
    {
      "message": "Campaign created successfully",
      "campaignId": "string"
    }

8. Get Campaigns

GET /api/campaigns

  • Description: Retrieve all campaigns.
  • Headers:
    • Authorization: Bearer <token>
  • Response:
    [
      {
        "campaignId": "string",
        "name": "string",
        "emailsSent": "integer",
        "status": "pending | ongoing | completed"
      }
    ]

9. Update Campaign

PUT /api/campaigns/:campaignId

  • Description: Update a campaign.
  • Headers:
    • Authorization: Bearer <token>
      • Request Body:
    {
      "name": "string",
      "emails": ["string"],
      "template": "string",
      "schedule": "ISO_8601 string"
    }
  • Response:
    {
      "message": "Campaign updated successfully"
    }

Analytics

10. Get Campaign Analytics

GET /api/analytics/:campaignId

  • Description: Retrieve analytics for a specific campaign.
  • Headers:
    • Authorization: Bearer <token>
  • Response:
    {
      "openRate": "percentage",
      "clickThroughRate": "percentage",
      "responseRate": "percentage",
      "bounces": "integer",
      "unsubscribes": "integer"
     }

11. Get General Analytics

GET /api/analytics

  • Description: Retrieve overall email campaign performance.
  • Headers:
    • Authorization: Bearer <token>
  • Response:
    {
      "totalEmailsSent": "integer",
      "totalResponses": "integer",
      "totalBounces": "integer",
      "totalUnsubscribes": "integer"
    }

Compliance

12. Get Compliance Settings

GET /api/compliance

  • Description: Retrieve GDPR and CAN-SPAM compliance settings.
  • Headers:
    • Authorization: Bearer <token>
  • Response:
    {
      "optOutLink": "string",
      "senderVerification": "boolean"
     }

13. Update Compliance Settings

PUT /api/compliance

  • Description: Update compliance settings.
  • Headers:
    • Authorization: Bearer <token>
  • Request Body:
    {
      "optOutLink": "string",
      "senderVerification": "boolean"
    }
  • Response:
    {
      "message": "Compliance settings updated successfully"
    }