Skip to content

Docs REST API

Contacts

List, read, create or update, and update the contacts of a project through the REST API.

A contact is a customer of a project. Read Contacts and revenue for the concepts.

Method Path What it does
GET /contacts Lists the contacts.
POST /contacts Creates a contact, or updates the contact with the same email.
GET /contacts/{id} Returns one contact.
PUT, PATCH /contacts/{id} Updates a contact.

The API cannot delete a contact.

The contact object

JSON

{
  "id": 7,
  "uuid": "4f6c2a5e-7d3b-4d1e-9c8a-2b1f0e9d8c7b",
  "user_id": null,
  "client_id": 1,
  "name": "Jane Doe",
  "email": "jane@example.com",
  "notes": null,
  "avatar": "https://feedback.example.com/storage/avatars/7/avatar.png",
  "mrr": 49,
  "ltv": 1200,
  "top_customer": 0,
  "created_at": "2026-11-17T09:00:00.000000Z",
  "updated_at": "2026-11-17T09:00:00.000000Z",
  "tags": [],
  "votes": [],
  "plan": "pro"
}
Field Description
user_id The user of an admin contact, or null for a customer.
avatar The avatar URL. If the contact has no avatar, the app makes an image with the initials.
mrr, ltv The revenue of the customer. Read Contacts and revenue.
Custom attributes Each custom attribute is a field of the object, for example plan. The object has no metadata field.

The list and one contact add tags and votes. Create and update return tags.

List contacts

HTTP

GET /contacts
Parameter In Description
page, per_page query Pagination. Read API overview.
search query Finds the text in name or email.
tag query Only the contacts with a tag of this title.
sort_by query created_at (default), updated_at, name, email, mrr or ltv.
sort_direction query desc (default) or asc.

The list also holds the admin contacts of the users.

Example request

Terminal

curl 'https://feedback.example.com/api/public/v1/contacts?sort_by=mrr&sort_direction=desc' \
  -H 'Authorization: Bearer <your-token>' \
  -H 'Accept: application/json'

Example response

200:

JSON

{
  "current_page": 1,
  "data": [
    {
      "id": 7,
      "uuid": "4f6c2a5e-7d3b-4d1e-9c8a-2b1f0e9d8c7b",
      "user_id": null,
      "client_id": 1,
      "name": "Jane Doe",
      "email": "jane@example.com",
      "notes": null,
      "avatar": "https://feedback.example.com/storage/avatars/7/avatar.png",
      "mrr": 49,
      "ltv": 1200,
      "top_customer": 0,
      "created_at": "2026-11-17T09:00:00.000000Z",
      "updated_at": "2026-11-17T09:00:00.000000Z",
      "tags": [
        {
          "id": 3,
          "client_id": 1,
          "title": "ui",
          "created_at": "2026-11-17T09:00:00.000000Z",
          "updated_at": "2026-11-17T09:00:00.000000Z"
        }
      ],
      "votes": [
        {
          "id": 90,
          "contact_id": 7,
          "votable_type": "App\\Models\\Post",
          "votable_id": 42,
          "created_at": "2026-11-17T09:00:00.000000Z",
          "updated_at": "2026-11-17T09:00:00.000000Z"
        }
      ],
      "plan": "pro"
    }
  ],
  "first_page_url": "https://feedback.example.com/api/public/v1/contacts?page=1",
  "from": 1,
  "last_page": 1,
  "last_page_url": "https://feedback.example.com/api/public/v1/contacts?page=1",
  "links": [],
  "next_page_url": null,
  "path": "https://feedback.example.com/api/public/v1/contacts",
  "per_page": 15,
  "prev_page_url": null,
  "to": 1,
  "total": 1
}

Get a contact

HTTP

GET /contacts/{id}

Returns the contact with tags and votes.

Example request

Terminal

curl https://feedback.example.com/api/public/v1/contacts/7 \
  -H 'Authorization: Bearer <your-token>' \
  -H 'Accept: application/json'

Example response

200:

JSON

{
  "id": 7,
  "uuid": "4f6c2a5e-7d3b-4d1e-9c8a-2b1f0e9d8c7b",
  "user_id": null,
  "client_id": 1,
  "name": "Jane Doe",
  "email": "jane@example.com",
  "notes": null,
  "avatar": "https://feedback.example.com/storage/avatars/7/avatar.png",
  "mrr": 49,
  "ltv": 1200,
  "top_customer": 0,
  "created_at": "2026-11-17T09:00:00.000000Z",
  "updated_at": "2026-11-17T09:00:00.000000Z",
  "tags": [
    {
      "id": 3,
      "client_id": 1,
      "title": "ui",
      "created_at": "2026-11-17T09:00:00.000000Z",
      "updated_at": "2026-11-17T09:00:00.000000Z"
    }
  ],
  "votes": [
    {
      "id": 90,
      "contact_id": 7,
      "votable_type": "App\\Models\\Post",
      "votable_id": 42,
      "created_at": "2026-11-17T09:00:00.000000Z",
      "updated_at": "2026-11-17T09:00:00.000000Z"
    }
  ],
  "plan": "pro"
}

Create or update a contact

HTTP

POST /contacts

The app looks for a contact with the same email in the project. If it finds one, it updates that contact. If not, it creates a contact.

Field Type Required Rules
name string Yes Maximum 255 characters
email string Yes A valid email, maximum 255 characters
avatar string No A URL
mrr number No Default 0 for a new contact
ltv number No Default 0 for a new contact
tags integer array No Tag IDs of the project. The list replaces all the tags of the contact.
metadata object No Custom attributes
Other fields any No Each other field is a custom attribute.

The custom attributes must obey these limits, or the request returns 422 with an error on metadata:

  • No key starts with pilgrim_.
  • 50 keys or fewer, nested keys included.
  • 3 levels of nesting or fewer.
  • 16 KB or less as JSON.

For an existing contact, the app merges the new custom attributes with the old ones.

Status Meaning
201 The app created a contact.
200 The app updated the contact with this email.

Example request

Terminal

curl -X POST https://feedback.example.com/api/public/v1/contacts \
  -H 'Authorization: Bearer <your-token>' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{"name":"Jane Doe","email":"jane@example.com","mrr":49,"ltv":1200,"tags":[3],"plan":"pro"}'

Example response

201:

JSON

{
  "id": 7,
  "uuid": "4f6c2a5e-7d3b-4d1e-9c8a-2b1f0e9d8c7b",
  "user_id": null,
  "client_id": 1,
  "name": "Jane Doe",
  "email": "jane@example.com",
  "notes": null,
  "avatar": "https://feedback.example.com/storage/avatars/7/avatar.png",
  "mrr": 49,
  "ltv": 1200,
  "top_customer": 0,
  "created_at": "2026-11-17T09:00:00.000000Z",
  "updated_at": "2026-11-17T09:00:00.000000Z",
  "tags": [
    {
      "id": 3,
      "client_id": 1,
      "title": "ui",
      "created_at": "2026-11-17T09:00:00.000000Z",
      "updated_at": "2026-11-17T09:00:00.000000Z"
    }
  ],
  "plan": "pro"
}

Update a contact

HTTP

PATCH /contacts/{id}
Field Type Rules
name string Maximum 255 characters
email string A valid email, unique in the project
avatar string A URL
mrr number
ltv number
tags integer array Tag IDs of the project. The list replaces all the tags.

This endpoint does not change the custom attributes. To change them, use POST /contacts with the email of the contact.

200 returns the contact.

Example request

Terminal

curl -X PATCH https://feedback.example.com/api/public/v1/contacts/7 \
  -H 'Authorization: Bearer <your-token>' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{"mrr":99}'

Example response

200:

JSON

{
  "id": 7,
  "uuid": "4f6c2a5e-7d3b-4d1e-9c8a-2b1f0e9d8c7b",
  "user_id": null,
  "client_id": 1,
  "name": "Jane Doe",
  "email": "jane@example.com",
  "notes": null,
  "avatar": "https://feedback.example.com/storage/avatars/7/avatar.png",
  "mrr": 99,
  "ltv": 1200,
  "top_customer": 0,
  "created_at": "2026-11-17T09:00:00.000000Z",
  "updated_at": "2026-11-17T09:00:00.000000Z",
  "tags": [
    {
      "id": 3,
      "client_id": 1,
      "title": "ui",
      "created_at": "2026-11-17T09:00:00.000000Z",
      "updated_at": "2026-11-17T09:00:00.000000Z"
    }
  ],
  "plan": "pro"
}

PHP example

Send the revenue of each customer from your billing code, in PHP:

PHP

use Illuminate\Support\Facades\Http;

$response = Http::withToken(config('services.feedback_pilgrim.token'))
    ->acceptJson()
    ->post('https://feedback.example.com/api/public/v1/contacts', [
        'name' => $customer->name,
        'email' => $customer->email,
        'mrr' => $customer->monthly_revenue,
        'ltv' => $customer->lifetime_revenue,
        'plan' => $customer->plan,
    ])
    ->throw();

$created = $response->status() === 201;

Edit this page on GitHub