Ticket creation API sometimes return No lookup value found for 'customer'


  • Used Zammad version: 5.1.x
  • Used Zammad installation type: docker-compose

Expected behavior:

The ticket should be created without a lookup error.

Actual behavior:

The ticket creating sometimes fails with invalid Customer ID if the customer is new and it was created in the previous API call.

Steps to reproduce the behavior:

Our code works in a way, that:

  1. it is checking the user existence based on the email address (/api/v1/users/search → email.keyword:USER EMAIL ADDRESS)
  2. if the user was not found, it is creating a new user (/api/v1/users) and remembers the returned user ID of the newly created user ($data->id). If the user is found, then the returned user ID ($data[0]->id) is remembered
  3. creates a new ticket using the user ID got in the previous steps (/api/v1/tickets → ‘customer’ => $customerId)

The ticket creation sometimes fails with error:
{“error”:“No lookup value found for 'customer': \“667\””,“error_human”:“No lookup value found for 'customer': \“667\””}',

It is very strange as at point 2 the customer ID 667 was returned by zammad, we see it in our logs, so the customer was definitely created.

Is this a bug, or an expected behavior? Is there any best practice, how we can handle this case? Retry? Wait?

Just for completeness, here are the exact API calls for user and ticket creation:

$url = $this->_zammadBaseUrl . '/api/v1/users';
$postData = array(
	'body' => array(
		"firstname"=> $splitName[0],
		"lastname"=> $splitName[1],
		"email"=> $userEmail,
		"roles"=> ["Customer"]
	'headers' => array(
		'Authorization' => 'Token token=' . $this->_zammadApiToken


$customerId = 0;
	$data = json_decode($resp['body']);
	if($data !== null){
		$customerId = $data->id;
		$this->logExt('New customer id', $customerId);
	$this->log('Failed to create the customer.');
$url = $this->_zammadBaseUrl . '/api/v1/tickets';
$postData = array(
	'body' => array(
		'title' => $subject,
		'group' => $group,
		'customer' => $customerId,
		'article' => array(
			'subject' => $subject,
			'body' => $message,
			'from' => $email,
  			'type' => 'web',
			'content_type' => 'text/html'
	'headers' => array(
		'Authorization' => 'Token token=' . $this->_zammadApiToken

Any help is appreciated!

We’re currently on Zammad 5.3.1, you should consider updating asap.

That doesn’t look right. customer is an object (technically) and shouldn’t get an ID.
If that’s not helping contact the vendor of whatever libary you’re using there. You may use it wrong. Can’t tell.

Thanks for the update. We will update then to 5.3. Regarding the code, it is our custom code (custom plugin in WordPress), so we can change it to anything else. Could you please given me any hint, how a customer can be/must be then specified for a ticket?


As mentioned in Tickets — Zammad documentation

use either:

  • customer: "guess:<email-address>"
  • customer_id: <customer-id>
  • customer: "<email-address>" (requires customer account to exist)

Thanks for you answer. In the meantime we have updated our Zammad instance and changed the customer to customer_id. We will see, if the issue got resolved or not.

1 Like

This topic was automatically closed 360 days after the last reply. New replies are no longer allowed.