REST API · v1

API Reference

Integrate Markt into your application. Manage contacts, control campaigns, and track results programmatically.

Introduction

The Markt API is a RESTful API that uses JSON for request and response payloads. All endpoints return standard HTTP status codes and use Bearer token authentication.

Authentication

Authenticate API requests using a Sanctum Bearer token. Include the token in the Authorization header of every request.

Authorization: Bearer YOUR_API_TOKEN

API tokens are scoped to your team. Generate tokens from your team settings in the dashboard.

Base URL

All API requests should be made to:

https://your-domain.com/api/v1

Rate Limiting

API requests are limited to 60 requests per minute per API token. Rate limit information is included in response headers:

  • X-RateLimit-Limit — Maximum requests allowed
  • X-RateLimit-Remaining — Remaining requests in current window
  • X-RateLimit-Reset — Unix timestamp when limit resets

Error Handling

The API uses standard HTTP status codes to indicate success or failure:

Code Description
200 Success
201 Created
401 Unauthorized
403 Forbidden
404 Not Found
422 Validation Error
429 Too Many Requests
500 Server Error

Validation errors return a 422 status with a JSON object containing error messages:

{
  "message": "The given data was invalid.",
  "errors": {
    "email": ["The email field is required."]
  }
}

Contacts

Manage your contact list with full CRUD operations. Contacts can be segmented and assigned to campaigns.

GET /api/v1/contacts

Retrieve a paginated list of contacts. Supports filtering by search query and status.

Query Parameters

Name Type Description
search string Search by email or name
status string Filter by status (active, unsubscribed, bounced)
page integer Page number (default: 1)

Response

{
  "data": [
    {
      "id": 1,
      "email": "[email protected]",
      "first_name": "John",
      "last_name": "Doe",
      "status": "active",
      "created_at": "2024-01-15T10:00:00Z"
    }
  ],
  "meta": {
    "current_page": 1,
    "per_page": 15,
    "total": 100
  }
}
POST /api/v1/contacts

Create a new contact in your team.

Request Body (JSON)

Field Type Description
email required string Contact email address
first_name string First name
last_name string Last name

Response

{
  "id": 1,
  "email": "[email protected]",
  "first_name": "John",
  "last_name": "Doe",
  "status": "active",
  "created_at": "2024-01-15T10:00:00Z"
}
GET /api/v1/contacts/{id}

Retrieve a specific contact by ID.

Response

{
  "id": 1,
  "email": "[email protected]",
  "first_name": "John",
  "last_name": "Doe",
  "status": "active",
  "segments": [
    {
      "id": 1,
      "name": "VIP Customers"
    }
  ],
  "created_at": "2024-01-15T10:00:00Z"
}
PUT /api/v1/contacts/{id}

Update an existing contact.

Request Body (JSON)

Field Type Description
email string Contact email address
first_name string First name
last_name string Last name
DELETE /api/v1/contacts/{id}

Permanently delete a contact from your team.

Campaigns

Read campaign details and control campaign execution. Use the API to start, pause, and monitor your email campaigns.

GET /api/v1/campaigns

Retrieve a list of all campaigns in your team.

GET /api/v1/campaigns/{id}

Retrieve detailed information about a specific campaign, including steps and email accounts.

Response

{
  "id": 1,
  "name": "Welcome Series",
  "status": "active",
  "steps": [
    {
      "id": 1,
      "subject": "Welcome!",
      "delay_days": 0
    }
  ],
  "email_accounts": [
    {
      "id": 1,
      "email": "[email protected]"
    }
  ]
}
POST /api/v1/campaigns/{id}/start

Start a paused or draft campaign. The campaign will begin sending emails according to its schedule.

POST /api/v1/campaigns/{id}/pause

Pause an active campaign. No new emails will be sent, but in-progress sends will complete.

GET /api/v1/campaigns/{id}/stats

Get real-time statistics for a campaign, including sends, opens, clicks, and replies.

Need webhook events?

Set up webhooks to receive real-time notifications when emails are sent, opened, clicked, or bounced.