Resource

Contacts

Contacts are the foundation of the Flashy platform. You can create them based on any unique key that you prefer, with email being the default primary key.

We created a list of properties you can use to segment your contacts, and you can always create custom properties using our dashboard — read more about Contact Properties.

Endpoints

Create (or upsert) a contact

POST /contact

Create or update contacts on Flashy by using the overwrite parameter.

Be sure to use the right primary key — our default is email address, but you can use any key you wish.

You can add a contact to a specific list using the lists object: the key is the List ID and the value is true if the customer is marketing-eligible.

Body parameters

  • primary_key string required
    Name of the primary key
  • overwrite boolean
    Update the contact if it exists
  • contact object required
    The contact object. Besides the documented properties, any custom contact property created in your dashboard can be set as an additional key.
  • contact.email string (email)
  • contact.first_name string
  • contact.last_name string
  • contact.phone string
  • contact.birthday integer
    Unix timestamp
  • contact.source string
  • contact.lists object
    Key is the List ID; value is true if the contact is marketing-eligible for that list.
Request
curl -X POST "https://api.flashy.app/contact" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "primary_key": "email",
    "overwrite": false,
    "contact": {
        "email": "user1@name.com",
        "first_name": "Rafael",
        "last_name": "Mor",
        "lists": {
            "159": true,
            "170": false
        },
        "birthday": 1631631569
    }
}'
Send your API key in the x-api-key header. Authentication
// Runs in the visitor's browser once the base pixel is installed — no API key.
// The second argument is an optional list ID to subscribe the contact to.
flashy.contacts.create({
    email: 'user1@name.com',
    first_name: 'Rafael',
    last_name: 'Mor',
}, 159);

// Create or update (the REST `overwrite: true`):
flashy.contacts.createOrUpdate({ email: 'user1@name.com', first_name: 'Rafael' }, 159);
Runs in the visitor’s browser through the website pixel — no API key. Install the pixel
$flashy = new Flashy\Flashy(['api_key' => 'YOUR_API_KEY']);

// create($contact, $primary_key = 'email', $tracking = true, $overwrite = null)
// Pass true as the last argument to update the contact if it already exists.
$flashy->contacts->create([
    'email' => 'user1@name.com',
    'first_name' => 'Rafael',
    'last_name' => 'Mor',
    'lists' => ['159' => true, '170' => false],
    'birthday' => 1631631569,
], 'email', true, false);
composer require flashy/flashy-php PHP SDK setup
has no method for this endpoint — showing REST.
Response 200 The created contact.
{
    "success": true,
    "data": {
        "email": "user1@name.com",
        "first_name": "Rafael",
        "last_name": "Mor",
        "birthday": 1631631569,
        "created_at": 1631631588,
        "contact_id": "2291112565587e24668e171940cab7cc",
        "lists": {}
    }
}

Get a contact

GET /contact/{identifier}

Use your primary key to find a contact — e.g. GET /contact/user1@name.com?primary_key=email or GET /contact/1a6711a68d0c381013ab72d3320ba4e5?primary_key=contact_id.

Path parameters

  • identifier string required
    The contact identifier (the value of the primary key, e.g. the email address or contact_id).

Query parameters

  • primary_key string default: email
    The primary key to look the contact up by. Default is email.
Request
curl "https://api.flashy.app/contact/user1@name.com?primary_key=email" \
  -H "x-api-key: YOUR_API_KEY"
Send your API key in the x-api-key header. Authentication
// get(identifier, primary_key = 'email')
flashy.contacts.get('user1@name.com', 'email').then(({ data }) => {
    console.log(data);
});
Runs in the visitor’s browser through the website pixel — no API key. Install the pixel
$flashy = new Flashy\Flashy(['api_key' => 'YOUR_API_KEY']);

// get($identifier, $primary_key = 'email')
$contact = $flashy->contacts->get('user1@name.com', 'email');
composer require flashy/flashy-php PHP SDK setup
has no method for this endpoint — showing REST.
Response 200 The contact.
{
    "success": true,
    "data": {
        "contact_id": "1a6711a68d0c381013ab72d3320ba4e5",
        "email": "user1@name.com",
        "birthday": 1631631569,
        "created_at": 1632022656,
        "phone": "",
        "first_name": "Rafael",
        "last_name": "Mor",
        "lists": {}
    }
}

Update a contact

PUT /contact/{identifier}

Update contact properties by the contact primary key.

Note that the contact's primary-key value must be part of the endpoint URL to find the contact. The primary key itself can't be updated.

Path parameters

  • identifier string required
    The contact identifier (the value of the primary key, e.g. the email address or contact_id).

Query parameters

  • primary_key string default: email
    The primary key to look the contact up by. Default is email.

Body parameters

  • contact object required
    The contact object. Besides the documented properties, any custom contact property created in your dashboard can be set as an additional key.
  • contact.email string (email)
  • contact.first_name string
  • contact.last_name string
  • contact.phone string
  • contact.birthday integer
    Unix timestamp
  • contact.source string
  • contact.lists object
    Key is the List ID; value is true if the contact is marketing-eligible for that list.
Request
curl -X PUT "https://api.flashy.app/contact/user1@name.com?primary_key=email" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "contact": {
        "last_name": "Mor",
        "source": "Google",
        "lists": {
            "159": true
        }
    }
}'
Send your API key in the x-api-key header. Authentication
// Updates the contact currently identified in this browser
// (after flashy.contacts.create() or flashy('setCustomer', ...)).
flashy.contacts.update({
    last_name: 'Mor',
    source: 'Google',
});
Runs in the visitor’s browser through the website pixel — no API key. Install the pixel
$flashy = new Flashy\Flashy(['api_key' => 'YOUR_API_KEY']);

// update($contact, $primary_key = 'email') — the contact array must include
// the primary-key value (here: email) so the SDK knows which contact to update.
$flashy->contacts->update([
    'email' => 'user1@name.com',
    'last_name' => 'Mor',
    'source' => 'Google',
    'lists' => ['159' => true],
], 'email');
composer require flashy/flashy-php PHP SDK setup
has no method for this endpoint — showing REST.
Response 200 The updated contact.
{
    "success": true,
    "data": {
        "contact_id": "1a6711a68d0c381013ab72d3320ba4e5",
        "email": "user1@name.com",
        "birthday": 1631631569,
        "created_at": 1632022656,
        "phone": "",
        "first_name": "Rafael",
        "last_name": "Mor",
        "source": "Google",
        "lists": {}
    }
}

Block a contact

POST /contact/{identifier}/block

Mark a contact as blocked whenever you don't want them to receive Flashy emails and SMS messages. The platform will mark them as unsubscribed on all mailing lists they are a member of.

The contact can sign up again and the status will change to subscribed based on the list they signed up for.

Path parameters

  • identifier string required
    The contact identifier (the value of the primary key).

Query parameters

  • primary_key string default: email
    The primary key to look the contact up by. Default is email.
Request
curl -X POST "https://api.flashy.app/contact/user1@name.com/block?primary_key=email" \
  -H "x-api-key: YOUR_API_KEY"
Send your API key in the x-api-key header. Authentication
$flashy = new Flashy\Flashy(['api_key' => 'YOUR_API_KEY']);

// block($identifier, $primary_key = 'email')
$flashy->contacts->block('user1@name.com', 'email');
composer require flashy/flashy-php PHP SDK setup
has no method for this endpoint — showing REST.
Response 200 Contact blocked.
{
    "success": true,
    "data": null
}