API Requests
Use the MemberDrive API to programmatically access and manage your organization's data.
MemberDrive API
The MemberDrive API is a REST API that allows you to programmatically read and write data in your organization. You can use it to integrate MemberDrive with your own tools, automate workflows, or build custom reports.
All API requests require authentication with an API key and are scoped to your organization.
Creating an API Key
Before you can make API requests, you'll need to create an API key.
- Go to your Dashboard
- Click Settings in the navigation
- Click the API Keys tab
- Click New API Key
- Give your key a descriptive name (e.g.
Data Export Script
orNewsletter Integration
) - Click Create API Key
Important: Your API key is only shown once, immediately after creation. Copy it and store it somewhere secure (such as a password manager or environment variable). You will not be able to view it again.
If you lose your key, simply delete it and create a new one.
Authentication
All API requests must include your API key as a Bearer token in the Authorization header:
Authorization: Bearer YOUR_API_KEY
Requests without a valid API key will receive a 401 Unauthorized response.
Base URL
https://memberdrive.org/api/v1
All endpoints below are relative to this base URL.
Supported Endpoints
| Resource | List | Get | Create | Update | Delete |
|---|---|---|---|---|---|
| Posts | ✓ | ✓ | ✓ | ✓ | ✓ |
More endpoints are planned for future releases. If you have a specific integration need, please contact us.
Posts
Posts are updates, news, and stories published to your campaign. The Posts API allows you to list, create, update, and delete posts programmatically.
List Posts
Returns all posts for your organization, sorted by most recent first.
GET /api/v1/posts
Required query parameters:
| Parameter | Description |
|---|---|
campaign_id |
The campaign ID or friendly ID (slug) to filter posts by. E.g. pets-for-vets or 157b1d1b-46eb-4296-a3c2-9fc008c64d86 |
Example:
curl -X GET "https://memberdrive.org/api/v1/posts?campaign_id=pets-for-vets" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json"
Optional query parameters:
| Parameter | Description |
|---|---|
page |
Page number (default: 1) |
Response:
Returns a paginated JSON object with a posts array and a pagination object:
{
"posts": [
{
"id": "01234567-89ab-cdef-0123-456789abcdef",
"slug": "welcome-to-our-campaign",
"title": "Welcome to Our Campaign",
"status": "published",
"published_at": "2025-01-15T12:00:00.000Z",
"members_only": false,
"sticky": false,
"content": "<p>Hello and welcome...</p>",
"campaign_id": "fedcba98-7654-3210-fedc-ba9876543210",
"created_at": "2025-01-15T11:30:00.000Z",
"updated_at": "2025-01-15T12:00:00.000Z"
}
],
"pagination": {
"count": 42,
"page": 1,
"pages": 3,
"next": 2,
"prev": null
}
}
Get a Post
Returns a single post by ID.
GET /api/v1/posts/:id
Example:
curl -X GET "https://memberdrive.org/api/v1/posts/01234567-89ab-cdef-0123-456789abcdef" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json"
Create a Post
Creates a new post in a campaign. The campaign_id field is required.
POST /api/v1/posts
Request body (JSON):
| Field | Type | Required | Description |
|---|---|---|---|
campaign_id |
string | Yes | The ID or friendly ID (slug) of the campaign this post belongs to |
title |
string | Yes | The title of the post |
content |
string | No | The body content of the post (HTML supported) |
status |
string | No | draft or published (default: draft) |
published_at |
string | No | ISO 8601 datetime for scheduled publishing |
members_only |
boolean | No | Restrict post visibility to members only |
sticky |
boolean | No | Pin the post to the top of the feed |
Example:
curl -X POST "https://memberdrive.org/api/v1/posts" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"post": {
"campaign_id": "fedcba98-7654-3210-fedc-ba9876543210",
"title": "Our Latest Update",
"content": "<p>Exciting news to share with you today...</p>",
"status": "published"
}
}'
Returns the created post with HTTP status 201 Created.
Update a Post
Updates an existing post by ID.
PATCH /api/v1/posts/:id
Example:
curl -X PATCH "https://memberdrive.org/api/v1/posts/01234567-89ab-cdef-0123-456789abcdef" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"post": {
"title": "Updated Title",
"status": "published"
}
}'
Returns the updated post with HTTP status 200 OK.
Delete a Post
Permanently deletes a post by ID.
DELETE /api/v1/posts/:id
Example:
curl -X DELETE "https://memberdrive.org/api/v1/posts/01234567-89ab-cdef-0123-456789abcdef" \
-H "Authorization: Bearer YOUR_API_KEY"
Returns HTTP status 204 No Content on success.
Pagination
List endpoints return paginated results. Pass a page parameter to navigate through pages.
GET /api/v1/posts?campaign_id=pets-for-vets&page=2
The response includes a pagination object alongside the results:
{
"posts": [...],
"pagination": {
"count": 42,
"page": 2,
"pages": 3,
"next": 3,
"prev": 1
}
}
| Field | Description |
|---|---|
count |
Total number of records across all pages |
page |
Current page number |
pages |
Total number of pages |
next |
Next page number, or null if on the last page |
prev |
Previous page number, or null if on the first page |
The default page size is 20 records per page.
Rich Text Content
Post content is stored as rich text and supports a subset of HTML. When creating or updating a post via the API, pass the content field as an HTML string.
Supported formatting
| Element | HTML |
|---|---|
| Paragraphs | <p>Your text here</p> |
| Bold | <strong>bold</strong> |
| Italic | <em>italic</em> |
| Links | <a href="https://example.com">link text</a> |
| Unordered lists | <ul><li>Item one</li><li>Item two</li></ul> |
| Ordered lists | <ol><li>First</li><li>Second</li></ol> |
| Headings | <h2>Section heading</h2> |
| Blockquotes | <blockquote>A quoted passage</blockquote> |
| Line breaks | <br> |
Example
curl -X POST "https://memberdrive.org/api/v1/posts" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"post": {
"campaign_id": "pets-for-vets",
"title": "Our Latest Update",
"status": "published",
"content": "<p>We have <strong>exciting news</strong> to share.</p><p>Here is what is happening this month:</p><ul><li>New milestone reached</li><li>Upcoming event on April 15</li></ul><p>Thank you for your continued support. <a href=\"https://example.com\">Learn more</a>.</p>"
}
}'
Reading content back
When you retrieve a post, the content field contains the rendered HTML. You can display this directly in a web page or parse it as needed.
Error Responses
The API uses standard HTTP status codes to indicate success or failure.
| Status | Meaning |
|---|---|
200 |
Success |
201 |
Resource created successfully |
204 |
Success with no response body (e.g. after a delete) |
401 |
Unauthorized — API key is missing or invalid |
404 |
Not found — the requested resource does not exist |
422 |
Unprocessable — the request body contains validation errors |
Error responses include a JSON body with details:
{
"error": "Campaign not found"
}
Validation errors return an errors object:
{
"errors": {
"title": ["can't be blank"]
}
}
Security Best Practices
- Never expose your API key in public code repositories or client-side JavaScript.
- Store your API key in an environment variable and reference it at runtime.
- If you suspect your key has been compromised, delete it immediately from Dashboard > Settings > API Keys and create a new one.
- Create separate API keys for separate integrations so you can revoke them independently.
Subscribe to receive our content right to your inbox.