API Reference

API Reference

Integrate Growffinity CRM with your applications using the RESTful API.

Authentication

All API requests require authentication using WordPress Application Passwords or API Keys.

Application Passwords

  1. Generate in WordPress: Users → Your Profile → Application Passwords
  2. Enter app name and click Add New Application Password
  3. Save the generated password
  4. Use Basic Auth in your requests

Base URL

All API endpoints are prefixed with:

https://yourstore.com/wp-json/growffinity/v1/

Common Parameters

Pagination

  • page - Page number (default: 1)
  • per_page - Items per page (default: 20, max: 100)

Filtering

Use filter parameters to narrow results

Sorting

  • orderby - Field to sort by
  • order - asc or desc

Customers

Get All Customers

GET /customers

Get Single Customer

GET /customers/{id}

Update Customer

PUT /customers/{id}

Get Customer Orders

GET /customers/{id}/orders

Add Customer to Segment

POST /customers/{id}/segments

Segments

Get All Segments

GET /segments

Get Single Segment

GET /segments/{id}

Create Segment

POST /segments

Update Segment

PUT /segments/{id}

Delete Segment

DELETE /segments/{id}

Get Segment Members

GET /segments/{id}/members

Refresh Segment

POST /segments/{id}/refresh

Campaigns

Get All Campaigns

GET /campaigns

Get Single Campaign

GET /campaigns/{id}

Create Campaign

POST /campaigns

Update Campaign

PUT /campaigns/{id}

Send Campaign

POST /campaigns/{id}/send

Get Campaign Stats

GET /campaigns/{id}/stats

Workflows

Get All Workflows

GET /workflows

Get Single Workflow

GET /workflows/{id}

Create Workflow

POST /workflows

Update Workflow

PUT /workflows/{id}

Activate Workflow

POST /workflows/{id}/activate

Trigger Workflow

POST /workflows/{id}/trigger

Analytics

Get Customer Analytics

GET /analytics/customers

Get Campaign Analytics

GET /analytics/campaigns

Get Segment Analytics

GET /analytics/segments/{id}

Get Revenue Analytics

GET /analytics/revenue

Export Data

POST /analytics/export

Webhooks

Register Webhook

POST /webhooks

Available Events

  • customer.created
  • customer.updated
  • order.completed
  • segment.updated
  • campaign.sent
  • campaign.opened
  • campaign.clicked
  • workflow.triggered
  • workflow.completed

Rate Limiting

API requests are limited to:

  • Standard: 100 requests per minute
  • Premium: 500 requests per minute

Error Handling

Common Error Codes

  • 400 - Bad Request
  • 401 - Unauthorized
  • 403 - Forbidden
  • 404 - Not Found
  • 429 - Too Many Requests
  • 500 - Internal Server Error

Best Practices

Authentication

  • Use Application Passwords
  • Rotate credentials regularly
  • Store credentials securely
  • Use HTTPS only

Performance

  • Use pagination for large datasets
  • Cache responses when appropriate
  • Use webhooks instead of polling
  • Batch requests when possible

Error Handling

  • Implement retry logic
  • Handle rate limiting gracefully
  • Log errors for debugging
  • Validate data before sending