The contact type of a lead is either a company or a contact. When companyId or company is present in the request then the contact type of the lead is set to company, and the contactId or contact must be a contact that belongs to that company. Otherwise the contact type of the lead is set to contact and contactId can be any valid contact in the account.