I’m pretty sure Contact Id 10 doesn’t exist as defined in this CreateReferralRequest
array (
contact_id => '10',
description => 'KeapConnect',
expiration_time => null,
ip_address => '127.0.0.1',
referral_partner_id => '309',
referral_time => '2026-03-16T01:14:19+00:00',
referral_type => 'MANUAL',
source => 'KeapConnect',
)
yet I get a status 201 response.
Hi Jeffrey, thanks for reaching out. Just to clarify, are you using the POST /v2/referrals endpoint?
I believe so.
$request = new CreateReferralRequest([
"contact_id" => $contact_id,
"referral_partner_id" => $affiliate_id,
'description' => $description,
'ip_address' => rgar($_SERVER, 'REMOTE_ADDR'),
'referral_time' => date(DATE_ATOM),
'referral_type' => CreateReferralRequest::REFERRAL_TYPE_MANUAL,
'source' => 'KeapConnect'
]);
$referral = null;
try {
$referral = self::initialize_referral_api()->createReferral($request);
} catch (Exception $e) {
// Log that referral could not be created
$message = sprintf("Could not create referral for '%s'\n%s", $affiliate_id, $e->getMessage());
}
I tested the endpoint both directly and through the PHP SDK, and it returns a 400 – unable to find this contact when the contact doesn’t exist. I’d suggest double-checking whether the contact is present in the app you’re calling.
@OmarAlmonte
It’s not there. This is a sandbox, where the next contact ID is 40K range. Thanks for checking.
I checked several times before posting, as a 201 return on this CreateReferralRequest made no sense given the inputs.
It looks like the error is triggered with a valid affiliate id, but an invalid contact id.
Thanks for the details, Jeffrey. Please DM me the app IP and we’ll investigate further.
Hi @Jeffrey_Chimene, thanks again for your patience.
We were able to confirm that Contact ID 10 does exist in the system, but it exists as a user, which is likely the source of the confusion and the unexpected behavior.
This isn’t the intended behavior for this endpoint, we should only be allowing valid contact records in this context. I will let you know once this is resolved.
@OmarAlmonte
I still don’t see Contact #10. I see #1 (user) & #31070 (user)
The only contact is #42935
Wow. That’s ancient. It must be inactve or some status that prevents it from loading on the User panel.
Some time in the past, the associated contact was deleted and the User deactivated. At #10, that’s quite old.