# Embedding API change? $.input is invalid

**URL:** <https://community.openai.com/t/embedding-api-change-input-is-invalid/707490>\
**Category:** API\
**Tags:** embeddings, api\
**Created:** [April 4, 2024, 1:49pm UTC](https://community.openai.com/t/embedding-api-change-input-is-invalid/707490 "2024-04-04T13:49:27Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![oye.gevalt](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/oye.gevalt/32/146595_2.png) [@oye.gevalt](https://community.openai.com/u/oye.gevalt)\
**Post date:** [April 4, 2024, 1:49pm UTC](https://community.openai.com/t/embedding-api-change-input-is-invalid/707490/1 "2024-04-04T13:49:27Z")

</div>

Out of nowhere I’m getting this error all the time, without fail. It was working perfectly before, no code changes since.

```auto
Error generating batch embeddings: Error code: 400 - 
{'error': {'message': "'$.input' is invalid. Please check the API reference: 
https://platform.openai.com/docs/api-reference.", 'type': 'invalid_request_error', 'param': None, 'code': None}}

```

---

<div class="post-metadata">

**Author:** ![\_j](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/_j/32/766292_2.png) [@\_j](https://community.openai.com/u/_j)\
**Post date:** [April 4, 2024, 3:42pm UTC](https://community.openai.com/t/embedding-api-change-input-is-invalid/707490/2 "2024-04-04T15:42:49Z")

</div>

Models seem to be working fine. Python openai-1.16.2. Sending a batch of 4 in a list.

— text-embedding-3-small  
==== 0 Embedding API Change? ====  
Embedding API Change?: 1.00000  
‘$.input’ is invalid.: 0.19563  
Please check the API reference: 0.42215  
invalid\_request\_error: 0.20202

— text-embedding-3-large  
==== 0 Embedding API Change? ====  
Embedding API Change?: 1.00000  
‘$.input’ is invalid.: 0.18608  
Please check the API reference: 0.36561  
invalid\_request\_error: 0.19878

— text-embedding-ada-002  
==== 0 Embedding API Change? ====  
Embedding API Change?: 1.00000  
‘$.input’ is invalid.: 0.71359  
Please check the API reference: 0.79991  
invalid\_request\_error: 0.73139

What is it, then, about your **input** that is invalid, we have to wonder…

---

<div class="post-metadata">

**Author:** ![oye.gevalt](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/oye.gevalt/32/146595_2.png) [@oye.gevalt](https://community.openai.com/u/oye.gevalt)\
**Post date:** [April 5, 2024, 4:06am UTC](https://community.openai.com/t/embedding-api-change-input-is-invalid/707490/3 "2024-04-05T04:06:20Z")

</div>

Thanks, I’ll explore further on my end.

---

<div class="post-metadata">

**Author:** ![malte1](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@malte1](https://community.openai.com/u/malte1)\
**Post date:** [June 11, 2024, 12:08pm UTC](https://community.openai.com/t/embedding-api-change-input-is-invalid/707490/4 "2024-06-11T12:08:47Z")

</div>

Same here… We also got it out of nowhere. Any updates to this?

---

<div class="post-metadata">

**Author:** ![malte1](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@malte1](https://community.openai.com/u/malte1)\
**Post date:** [June 12, 2024, 10:43am UTC](https://community.openai.com/t/embedding-api-change-input-is-invalid/707490/5 "2024-06-12T10:43:03Z")

</div>

I found the culprit of the issue here. The API accepts an empty string, and a list of strings, however, it returns the above-mentioned error when receiving a list with a single empty string. The documentation states that [the input cannot be an empty string](https://platform.openai.com/docs/api-reference/embeddings#:~:text=representing%20the%20input%20text.-,Request%20body,be%202048%20dimensions%20or%20less.%20Example%20Python%20code%20for%20counting%20tokens.,-Show%20possible%20types) which is very confusion. The documentation should probably be updated, and meanwhile, to fix the issue, you should make sure to not send a list with a single empty string.

---

<div class="post-metadata">

**Author:** ![jingwang.physics](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/jingwang.physics/32/454943_2.png) [@jingwang.physics](https://community.openai.com/u/jingwang.physics)\
**Post date:** [September 3, 2024, 1:53pm UTC](https://community.openai.com/t/embedding-api-change-input-is-invalid/707490/6 "2024-09-03T13:53:45Z")

</div>

other than empty string, it can be caused by too large of list, you might try to batch them

---

<div class="post-metadata">

**Author:** ![smoya](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/smoya/32/649898_2.png) [@smoya](https://community.openai.com/u/smoya)\
**Post date:** [July 2, 2025, 12:10pm UTC](https://community.openai.com/t/embedding-api-change-input-is-invalid/707490/7 "2025-07-02T12:10:10Z")

</div>

For the record, this happens when passing an empty array or an array with empty string as input.

```sh
curl https://api.openai.com/v1/embeddings \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
    "input": [],
    "model": "text-embedding-3-small"
  }'
{
  "error": {
    "message": "'$.input' is invalid. Please check the API reference: https://platform.openai.com/docs/api-reference.",
    "type": "invalid_request_error",
    "param": null,
    "code": null
  }
}

```

```sh
curl https://api.openai.com/v1/embeddings \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
    "input": [""],
    "model": "text-embedding-3-small"
  }'
{
  "error": {
    "message": "'$.input' is invalid. Please check the API reference: https://platform.openai.com/docs/api-reference.",
    "type": "invalid_request_error",
    "param": null,
    "code": null
  }
}

```
