# Missing contact type when trying to add multiple contacts to a Wallet

**URL:** https://community.rapyd.net/t/missing-contact-type-when-trying-to-add-multiple-contacts-to-a-wallet/407
**Category:** 🙋🏽‍♀️🙋🏽‍♂️ Ask Questions
**Created:** [June 9, 2021, 11:37pm UTC](https://community.rapyd.net/t/missing-contact-type-when-trying-to-add-multiple-contacts-to-a-wallet/407 "2021-06-09T23:37:29Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Shikhar\_Vaish](https://sea2.discourse-cdn.com/flex016/user_avatar/community.rapyd.net/shikhar_vaish/32/917_2.png) [@Shikhar\_Vaish](https://community.rapyd.net/u/Shikhar_Vaish)
#### Post date: [June 9, 2021, 11:37pm UTC](https://community.rapyd.net/t/missing-contact-type-when-trying-to-add-multiple-contacts-to-a-wallet/407/1 "2021-06-09T23:37:29Z")

</div>

Hi Everyone!

I’ve been trying to add some contacts to a wallet I created recently. Currently, I’m using sandbox environment.  
Following the documentation [here](https://docs.rapyd.net/build-with-rapyd/reference/wallet-contact-object#add-contact-to-wallet), I am repeatedly getting this error response:

```auto
{
    "status": {
        "error_code": "MISSING_EWALLET_CONTACT_TYPE",
        "status": "ERROR",
        "message": "The request tried to create or update a wallet contact, but the 'contact_type' was missing. The request was rejected. Corrective action: Set 'contact_type' to one of the following values: 'personal', 'business'",
        "response_code": "MISSING_EWALLET_CONTACT_TYPE",
        "operation_id": "fdc9b277-ddde-4fad-b3eb-df8113b59f1c"
    }
}

```

For the API call, this is my url:  
`/v1/ewallets/${ewalletId}/contacts`  
`ewalletId` is a variable that was created by calling [create wallet API](https://docs.rapyd.net/build-with-rapyd/reference/wallet-object#create-wallet).

And, this is the body:

```auto
{
      "first_name": "Jane",
      "last_name": "Doe",
      "middle_name": "",
      "second_last_name": "",
      "mothers_name": "Jane Smith",
      "gender": "female",
      "marital_status": "single",
      "house_type": "lease",
      "contact_type": "personal",
      "phone_number": "+14155551233",
      "email": "jane200@rapyd.net",
      "identification_type": "PA",
      "identification_number": "1233242424",
      "date_of_birth": "11/22/2000",
      "country": "US",
      "nationality": "FR",
      "address": {
          "name": "Jane Doe",
          "line_1": "123 Lake Forest Drive",
          "line_2": "",
          "line_3": "",
          "city": "Anytown",
          "state": "NY",
          "zip": "12345",
          "phone_number": "+14155551234",
          "metadata": {
              "merchant_defined": true
          },
          "canton": "",
          "district": ""
      },
      "metadata": {
          "merchant_defined": true
      }
  }

```

I’ve checked the signature and other header fields. I was able to create a wallet, do a test API call on the fetching list of countries as given in the documentation.

Please let me know how to fix this. Thanks!!

---

<div class="post-metadata">

### Author: ![Xi\_Li](https://sea2.discourse-cdn.com/flex016/user_avatar/community.rapyd.net/xi_li/32/76_2.png) [@Xi\_Li](https://community.rapyd.net/u/Xi_Li)
#### Post date: [June 10, 2021, 8:13am UTC](https://community.rapyd.net/t/missing-contact-type-when-trying-to-add-multiple-contacts-to-a-wallet/407/2 "2021-06-10T08:13:22Z")

</div>

Hi @Shikhar_Vaish I was using the body you shared above and no error appear on my end, the reason is that I’ve never added the contact with the same details to that wallet. So very likely, when creating the wallet, a contact is already created and the same details are used, so when you create an additional one, it causes conflict.

My suggestion is to run [Wallet Contact Object](https://docs.rapyd.net/build-with-rapyd/reference/wallet-contact-object#retrieve-wallet-contact) as to retrieve the existing contacts created under the wallet to see if the contract you want to create is already there.

Good luck with that and let us know in case of any further questions.

---

<div class="post-metadata">

### Author: ![CharlesDorsett](https://sea2.discourse-cdn.com/flex016/user_avatar/community.rapyd.net/charlesdorsett/32/47_2.png) [@CharlesDorsett](https://community.rapyd.net/u/CharlesDorsett)
#### Post date: [June 10, 2021, 8:28am UTC](https://community.rapyd.net/t/missing-contact-type-when-trying-to-add-multiple-contacts-to-a-wallet/407/3 "2021-06-10T08:28:35Z")

</div>

I’m having trouble reproducing this error. I’ve tried several variations and can’t get this specific error.

First of all, you can only add a contact to a company wallet, and the contact type is not specified as part of the request. This is because there is only one business contact, and the only type of contact you can add is a personal contact.

When you create your company wallet, you must make sure the ‘email’, ‘phone\_number’ and ‘ewallet\_reference\_id’ at the root of the request are unique - have not been used before. Please try again and let me know what results you get.

---

<div class="post-metadata">

### Author: ![Shikhar\_Vaish](https://sea2.discourse-cdn.com/flex016/user_avatar/community.rapyd.net/shikhar_vaish/32/917_2.png) [@Shikhar\_Vaish](https://community.rapyd.net/u/Shikhar_Vaish)
#### Post date: [June 10, 2021, 9:06am UTC](https://community.rapyd.net/t/missing-contact-type-when-trying-to-add-multiple-contacts-to-a-wallet/407/4 "2021-06-10T09:06:00Z")

</div>

Hi Charles! Thanks for the info. I had been using duplicate details.

I added a random input generator to make the demo API calls. I noticed null fields in response when I create a company wallet. Here are the details when I create a “company” ewallet having a “business” contact:  
**API url** `/v1/user`

**Request Body**

```auto
const body = {
      first_name: 'Shikhar',
      last_name: 'Vaish',
      ewallet_reference_id: `Shikhar-${uniqueNum1}-${uniqueNum2}`,
      metadata: {
        merchant_defined: true
      },
      type: 'company',
      contact: {
        phone_number: phoneNum1,
        email: email1,
        first_name: 'Shikhar',
        last_name: 'Vaish',
        mothers_name: 'Jane Smith',
        contact_type: 'business',
        address: {
          name: 'Shikhar Vaish',
          line_1: '123 Main Street',
          line_2: '',
          line_3: '',
          city: 'Anytown',
          state: 'NY',
          country: 'US',
          zip: '12345',
          phone_number: phoneNum2,
          metadata: { number: 2 },
          canton: '',
          district: ''
        },
        identification_type: 'PA',
        identification_number: identificationNum1,
        date_of_birth: '11/22/2000',
        country: 'US',
        metadata: {
          merchant_defined: true
        },
        business_details: {
          entity_type: 'association',
          name: 'Four Star Professional Services',
          registration_number: identificationNum2,
          industry_category: 'company',
          industry_sub_category: 'home services',
          address: {
            name: 'John Doe',
            line_1: '1234 Main Street',
            line_2: 'Suite 1200',
            line_3: '',
            city: 'Anytown',
            state: 'NY',
            country: 'US',
            zip: '10101',
            phone_number: phoneNum3,
            metadata: {
              merchant_defined: true
            }
          }
        }
      }
    };

```

**API Response** :

```auto
{
    "status": {
        "error_code": "",
        "status": "SUCCESS",
        "message": "",
        "response_code": "",
        "operation_id": "2a140df5-e8c6-4261-b182-e5d9ba15cdad"
    },
    "data": {
        "phone_number": null,
        "email": null,
        "first_name": null,
        "last_name": null,
        "id": "ewallet_1de586d02ef1141974162e7515be1d98",
        "status": "ACT",
        "accounts": [],
        "verification_status": "not verified",
        "type": "person",
        "metadata": {},
        "ewallet_reference_id": null,
        "category": null,
        "contacts": {
            "data": [
                {
                    "id": "cont_8d441499bc88d9d79d6ba2087d70f0c4",
                    "first_name": "",
                    "last_name": "",
                    "middle_name": "",
                    "second_last_name": "",
                    "gender": "not_applicable",
                    "marital_status": "not_applicable",
                    "house_type": "",
                    "contact_type": "personal",
                    "phone_number": "",
                    "email": "",
                    "identification_type": "",
                    "identification_number": "",
                    "preferred_name": "",
                    "date_of_birth": null,
                    "country": "",
                    "nationality": null,
                    "address": null,
                    "ewallet": "ewallet_1de586d02ef1141974162e7515be1d98",
                    "created_at": 1623315091,
                    "metadata": {},
                    "business_details": null,
                    "compliance_profile": 0,
                    "verification_status": "not verified",
                    "send_notifications": false,
                    "mothers_name": ""
                }
            ],
            "has_more": false,
            "total_count": 1,
            "url": "/v1/ewallets/ewallet_1de586d02ef1141974162e7515be1d98/contacts"
        }
    }
}

```

**Random Inputs**

- The phone numbers are of the following format: “+1\<10-digit random number\>”
- The identification number is of the following format: “\<10-digit random number\>”
- The ewallet\_reference\_id is “Shikhar-\<2-digit random number\>-\<2-digit random number\>”
- The email is of the following format: “shikhar.vaish\<4-digit random number\>@gmail.com”

With ewallet and contactIds as exceptions, other details are null. Also, `contact_type` is `personal` instead of `business`.

The wallets created are getting reflected on my web dashboard with matching Ids.

@Xi_Li I tried using the get contact, and get list of contacts API for the wallet. I get the single contact as above, that was created at the time of creating a wallet. And, it has “personal” type instead of “business” type.

---

<div class="post-metadata">

### Author: ![CharlesDorsett](https://sea2.discourse-cdn.com/flex016/user_avatar/community.rapyd.net/charlesdorsett/32/47_2.png) [@CharlesDorsett](https://community.rapyd.net/u/CharlesDorsett)
#### Post date: [June 10, 2021, 11:15am UTC](https://community.rapyd.net/t/missing-contact-type-when-trying-to-add-multiple-contacts-to-a-wallet/407/5 "2021-06-10T11:15:32Z")

</div>

Hi again. Again, I can’t make the API reproduce this. Let me suggest something - Why not start out by putting in only the required fields, then adding non-required fields one by one? Stepping through it like this will help pinpoint the trouble spot.

Personally, I don’t see any advantage to putting the phone number on the wallet itself, since each contact has his own phone number anyway. Same with the email. I’m puzzled, though, about why the first\_name and last\_name are not being returned in the response.

---

<div class="post-metadata">

### Author: ![Shikhar\_Vaish](https://sea2.discourse-cdn.com/flex016/user_avatar/community.rapyd.net/shikhar_vaish/32/917_2.png) [@Shikhar\_Vaish](https://community.rapyd.net/u/Shikhar_Vaish)
#### Post date: [June 10, 2021, 12:14pm UTC](https://community.rapyd.net/t/missing-contact-type-when-trying-to-add-multiple-contacts-to-a-wallet/407/6 "2021-06-10T12:14:08Z")

</div>

Hi!  
Okay. I just tried reducing the params…

**Body**

```auto
const uniqueNum1 = `${Date.now()}` // Javascript's Date object
const uniqueNum2 = `${Date.now()}`
const body ={
      contact: {
        contact_type: 'business',
        country: 'US',
        email: `shikhar.vaish${uniqueNum1%100}${uniqueNum2%100}@gmail.com`,
        first_name: 'Shikhar',       
        identification_number: `942${uniqueNum1%100}116${uniqueNum2%100}`,
        identification_type: 'PA',
        last_name: 'Vaish',
        phone_number: `+1812${uniqueNum1%100}307${uniqueNum2%100}`,
        
      },
      ewallet_reference_id: `Shikhar-${uniqueNum1}-${uniqueNum2}`,
      first_name: 'Shikhar',
      last_name: 'Vaish',
      type: 'company',
    };

```

**Response**

```auto
{
    "status": {
        "error_code": "",
        "status": "SUCCESS",
        "message": "",
        "response_code": "",
        "operation_id": "9bf5bc16-a4fe-481e-bd6f-0c71bed9dc2e"
    },
    "data": {
        "phone_number": null,
        "email": null,
        "first_name": null,
        "last_name": null,
        "id": "ewallet_f760992b34f1c4c0d2ff68e673ea1078",
        "status": "ACT",
        "accounts": [],
        "verification_status": "not verified",
        "type": "person",
        "metadata": {},
        "ewallet_reference_id": null,
        "category": null,
        "contacts": {
            "data": [
                {
                    "id": "cont_a13fff6bde3f233ca46cbc99717f010f",
                    "first_name": "",
                    "last_name": "",
                    "middle_name": "",
                    "second_last_name": "",
                    "gender": "not_applicable",
                    "marital_status": "not_applicable",
                    "house_type": "",
                    "contact_type": "personal",
                    "phone_number": "",
                    "email": "",
                    "identification_type": "",
                    "identification_number": "",
                    "preferred_name": "",
                    "date_of_birth": null,
                    "country": "",
                    "nationality": null,
                    "address": null,
                    "ewallet": "ewallet_f760992b34f1c4c0d2ff68e673ea1078",
                    "created_at": 1623326775,
                    "metadata": {},
                    "business_details": null,
                    "compliance_profile": 0,
                    "verification_status": "not verified",
                    "send_notifications": false,
                    "mothers_name": ""
                }
            ],
            "has_more": false,
            "total_count": 1,
            "url": "/v1/ewallets/ewallet_f760992b34f1c4c0d2ff68e673ea1078/contacts"
        }
    }
}

```

**Headers** :

```auto
const timestamp = (Math.floor(new Date().getTime() / 1000) - 10).toString()
    const salt = Date.now() + ''
    const http_method = 'post';
    const url_path = '/v1/user'
    const secret_key = config.secret_key
    const access_key = config.access_key
    const body_string = ''
    
    const to_sign = http_method + url_path + salt + timestamp + access_key + secret_key + body_string
    let signature = CryptoJS.enc.Hex.stringify(CryptoJS.HmacSHA256(to_sign, secret_key));
    signature = CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(signature));
    
    const headers = {
      'content-type': 'application/json',
      'access_key': access_key,
      'salt': salt,
      'signature': signature,
      'timestamp': timestamp
    }

```

---

<div class="post-metadata">

### Author: ![Legato](https://sea2.discourse-cdn.com/flex016/user_avatar/community.rapyd.net/legato/32/41_2.png) [@Legato](https://community.rapyd.net/u/Legato)
#### Post date: [June 10, 2021, 12:38pm UTC](https://community.rapyd.net/t/missing-contact-type-when-trying-to-add-multiple-contacts-to-a-wallet/407/7 "2021-06-10T12:38:14Z")

</div>

Hello,  
I tried to run a very similar request on my sandbox via Postman and did not receive null values in the contact’s first and last name. The response also includes the correct contact type.  
Here is the code. Please try it yourself and let me know if you still get null values and the wrong contact type.

```auto
curl --location --request POST 'https://sandboxapi.rapyd.net/v1/user' \
{
    "first_name": "Shikhar",
    "last_name": "Vaish",
    "ewallet_reference_id": "Shikhar1",
    "metadata": {
        "merchant_defined": true
    },
    "type": "company",
    "contact": {
        "phone_number": "+14155551311",
        "email": "1234email1@sample.net",
        "first_name": "Shikhar",
        "last_name": "Vaish",
        "mothers_name": "Jane Smith",
        "contact_type": "business",
        "address": {
            "name": "Shikhar Vaish",
            "line_1": "123 Main Street",
            "line_2": "",
            "line_3": "",
            "city": "Anytown",
            "state": "NY",
            "country": "US",
            "zip": "12345",
            "phone_number": "+14155551312",
            "metadata": {
                "merchant_defined": true
            },
            "canton": "",
            "district": ""
        },
        "identification_type": "PA",
        "identification_number": "identificationNum1",
        "date_of_birth": "11/22/2000",
        "country": "US",
        "metadata": {
            "merchant_defined": true
        },
        "business_details": {
            "entity_type": "association",
            "name": "Four Star Professional Services",
            "registration_number": "identificationNum2",
            "industry_category": "company",
            "industry_sub_category": "home services",
            "address": {
                "name": "John Doe",
                "line_1": "1234 Main Street",
                "line_2": "Suite 1200",
                "line_3": "",
                "city": "Anytown",
                "state": "NY",
                "country": "US",
                "zip": "10101",
                "phone_number": "+14155551321",
                "metadata": {
                    "merchant_defined": true
                }
            }
        }
    }
}

{
    "status": {
        "error_code": "",
        "status": "SUCCESS",
        "message": "",
        "response_code": "",
        "operation_id": "9beb37b8-16e0-4ded-a4b5-879b22da6360"
    },
    "data": {
        "phone_number": null,
        "email": null,
        "first_name": "Shikhar",
        "last_name": "Vaish",
        "id": "ewallet_eeaf7c3ac08f9a9f0338d18e1a31ba8e",
        "status": "ACT",
        "accounts": [],
        "verification_status": "not verified",
        "type": "company",
        "metadata": {
            "merchant_defined": true
        },
        "ewallet_reference_id": "Shikhar1",
        "category": null,
        "contacts": {
            "data": [
                {
                    "id": "cont_c31d9d0bee1080601752955003cf652d",
                    "first_name": "Shikhar",
                    "last_name": "Vaish",
                    "middle_name": "",
                    "second_last_name": "",
                    "gender": "not_applicable",
                    "marital_status": "not_applicable",
                    "house_type": "",
                    "contact_type": "business",
                    "phone_number": "+14155551311",
                    "email": "1234email1@sample.net",
                    "identification_type": "PA",
                    "identification_number": "identificationNum1",
                    "preferred_name": "",
                    "date_of_birth": "2000-11-22",
                    "country": "US",
                    "nationality": null,
                    "address": {
                        "id": "address_0e6b46ec83a217d9d9b973991e786ecd",
                        "name": "Shikhar Vaish",
                        "line_1": "123 Main Street",
                        "line_2": "",
                        "line_3": "",
                        "city": "Anytown",
                        "state": "NY",
                        "country": "US",
                        "zip": "12345",
                        "phone_number": "+14155551312",
                        "metadata": {
                            "merchant_defined": true
                        },
                        "canton": "",
                        "district": "",
                        "created_at": 1623328331
                    },
                    "ewallet": "ewallet_eeaf7c3ac08f9a9f0338d18e1a31ba8e",
                    "created_at": 1623328331,
                    "metadata": {
                        "merchant_defined": true
                    },
                    "business_details": {
                        "id": "busi_51339cac6676d7f451d62a915d5b1a8c",
                        "name": "Four Star Professional Services",
                        "registration_number": "identificationNum2",
                        "entity_type": "association",
                        "industry_category": "company",
                        "industry_sub_category": "home services",
                        "address": {
                            "id": "address_36ba0645e7d5be6e743e8dfe8ea56dc8",
                            "name": "John Doe",
                            "line_1": "1234 Main Street",
                            "line_2": "Suite 1200",
                            "line_3": "",
                            "city": "Anytown",
                            "state": "NY",
                            "country": "US",
                            "zip": "10101",
                            "phone_number": "+14155551321",
                            "metadata": {
                                "merchant_defined": true
                            },
                            "canton": "",
                            "district": "",
                            "created_at": 1623328331
                        },
                        "created_at": 1623328331,
                        "annual_revenue": 0,
                        "establishment_date": null,
                        "legal_entity_type": null,
                        "cnae_code": null
                    },
                    "compliance_profile": 0,
                    "verification_status": "not verified",
                    "send_notifications": false,
                    "mothers_name": "Jane Smith"
                }
            ],
            "has_more": false,
            "total_count": 1,
            "url": "/v1/ewallets/ewallet_eeaf7c3ac08f9a9f0338d18e1a31ba8e/contacts"
        }
    }
}

```

---

<div class="post-metadata">

### Author: ![Shikhar\_Vaish](https://sea2.discourse-cdn.com/flex016/user_avatar/community.rapyd.net/shikhar_vaish/32/917_2.png) [@Shikhar\_Vaish](https://community.rapyd.net/u/Shikhar_Vaish)
#### Post date: [June 10, 2021, 6:34pm UTC](https://community.rapyd.net/t/missing-contact-type-when-trying-to-add-multiple-contacts-to-a-wallet/407/8 "2021-06-10T18:34:12Z")

</div>

Hi! I just found the bug.  
I did not pass “body\_string” as required in signature. I was declaring body after the headers and making the API call.

I’m getting all responses correctly now. Thanks a lot!!

---

<div class="post-metadata">

### Author: ![CharlesDorsett](https://sea2.discourse-cdn.com/flex016/user_avatar/community.rapyd.net/charlesdorsett/32/47_2.png) [@CharlesDorsett](https://community.rapyd.net/u/CharlesDorsett)
#### Post date: [June 13, 2021, 6:56am UTC](https://community.rapyd.net/t/missing-contact-type-when-trying-to-add-multiple-contacts-to-a-wallet/407/9 "2021-06-13T06:56:49Z")

</div>

That would do it!

By the way, one thing to watch out for in the signature - Postman by default puts an empty pair of curly braces in the body. This will mess up the signature calculation, so if you have any requests with an empty body, be sure it’s really empty - delete those unhelpful curly braces. All GET methods have empty body sections, and some of the DELETE methods do too.

---

<div class="post-metadata">

### Author: ![Shikhar\_Vaish](https://sea2.discourse-cdn.com/flex016/user_avatar/community.rapyd.net/shikhar_vaish/32/917_2.png) [@Shikhar\_Vaish](https://community.rapyd.net/u/Shikhar_Vaish)
#### Post date: [June 13, 2021, 8:50am UTC](https://community.rapyd.net/t/missing-contact-type-when-trying-to-add-multiple-contacts-to-a-wallet/407/10 "2021-06-13T08:50:31Z")

</div>

Oh! I’ll keep that in mind.
