Need help with "Customer ID is invalid" issue

I’m facing an issue with my Customer ID, and I could really use your assistance. Whenever I try to use my Customer ID, I keep receiving an “invalid” response. Here’s what I’ve tried so far:

  1. On the console, I clicked on my username and copied the value displayed as my Customer ID.
  2. The copied value appears to be a bit strange to me since there’s a space between my email address and a ten-digit number.
  3. I’ve attempted different variations with the Customer ID: with the space, without the space, using only the number, and using only the email address. Unfortunately, none of these attempts have been successful.

I’m starting to wonder if I’m missing something obvious or if there’s a mistake on my part. Could someone please guide me on what I might be doing wrong? Any suggestions or insights would be greatly appreciated.

Hey, thanks for raising this! The current UX is very confusing, and I apologize for that. What gets copied to your clipboard is actually your email and your customer ID. The ten-digit number is your customer ID and should be what’s required by the API. I’ll fix this in the UI immediately.

You mentioned that you have already tried using just the ten-digit number, and that it’s not working. Let me see if I can help you figure out what’s going wrong. Can you tell me how you’re using your customer ID? If it’s as part of an API request, can you share the request with me? Please redact any sensitive information (including customer ID), by replacing it with XXX or something similar.

Thanks!

Thank you!

Here is my python code:

import requests
session = requests.Session()
import os

API_KEY = os.getenv("API_KEY")
CUSTOMER_ID = os.getenv("CUSTOMER_ID")
CORPUS_ID = os.getenv("CORPUS_ID")


files={
    "file": ("dummy.pdf", open("./dummy.pdf", "rb"), "application/octet-stream")
}

post_headers = {
"x-api-key": API_KEY
}

response = session.post(
    url = f"https://api.vectara.io/v1/upload?c={CUSTOMER_ID}&o={CORPUS_ID}",
    headers=post_headers,
    files=files)

print(response.text)

session.close()

Awesome! Thanks for sharing that. I took a look at our File Upload API playground and it looks like your definition of files might be off. It looks like the docs advise defining files as an array, whereas you’re using an object. I’m not super-familiar with Python, as you might guess from my terminology, so I could be wrong about that. Here’s what the playground link above spits out when I try to configure the request the way you have:

import requests
import os

API_KEY = os.getenv("API_KEY")
CUSTOMER_ID = os.getenv("CUSTOMER_ID")
CORPUS_ID = os.getenv("CORPUS_ID")

files=[
  ('file', ('dummy.pdf', open('./dummy.pdf', 'rb'), 'application/octet-stream'))
]

url = "https://api.vectara.io/v1/upload?c={CUSTOMER_ID}&o={CORPUS_ID}"

payload={}

headers = {
  'Content-Type': 'multipart/form-data',
  'Accept': 'application/json',
  'x-api-key': '<API_KEY_VALUE>'
}

response = requests.request("POST", url, headers=headers, data=payload, files=files)

print(response.text)

Can you give this a shot? Could you also print out CORPUS_ID to verify that it is indeed being picked up as an environment variable? Also, note that corpus ID and customer ID are both expected to be an integer. Will os.getenv() return an integer, or will it return a string that you need to cast as an int?

If this doesn’t work I’ll dig deeper.

Thank you so much for your response and providing me with the code. I gave it a try, and it seems like the API request is going through now. However, I encountered a new error message that I find a bit puzzling. The error I’m seeing is:

{"httpCode":400,"internalCode":3,"details":"Request entity too large."}

This error strikes me as odd because the file I’m trying to use is only 13kb in size. It doesn’t seem like it should exceed any limits. Additionally, I attempted using the API playground, but encountered a different error message there:

{"httpCode": 400, "internalCode": 3, "details": "'file' part not found."}

I’m not sure what could be causing these errors or how to proceed from here.

Here is a link to the pdf file I’m using: https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf

Thanks again for your assistance!

Apologies for the troubles. Indeed we support much larger sizes than 13kb, so the error seems off. I’m going to debug the error message and fix it.

Meanwhile, can you try the following code:

import requests
session = requests.Session()


files={
    "file": ("i1040gi.pdf", open("~/data/i1040gi.pdf", "rb"), "application/octet-stream")
}

post_headers = {
"x-api-key": API_KEY
}

response = session.post(
    url = f"https://api.vectara.io/v1/upload?c={CUSTOMER_ID}&o={CORPUS_ID}",
    headers=post_headers,
    files=files)

print(response.text)

session.close()

Thank you so much for your help and guidance. I’m relieved to report that everything is now working perfectly! However, I must make an embarrassing admission: the issue was actually caused by a spelling mistake on my part. It turns out I wasn’t loading the API key correctly. I apologize for the oversight and any confusion it may have caused.

I truly appreciate your patience and assistance throughout this process. Your support has been invaluable. If I come across any more hiccups or have further questions, I won’t hesitate to reach out to this helpful community.

Glad the issue was resolved. I’ll look into improving the error message, based on security practices.