# Docs have non working code: Completions.create() got an unexpected keyword argument 'search\_mode'

**URL:** <https://community.perplexity.ai/t/docs-have-non-working-code-completions-create-got-an-unexpected-keyword-argument-search-mode/770>\
**Category:** Bug Reports\
**Created:** [July 26, 2025, 11:14am UTC](https://community.perplexity.ai/t/docs-have-non-working-code-completions-create-got-an-unexpected-keyword-argument-search-mode/770 "2025-07-26T11:14:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dino\_Fancellu](https://sea1.discourse-cdn.com/flex001/user_avatar/community.perplexity.ai/dino_fancellu/32/482_2.png) [@Dino\_Fancellu](https://community.perplexity.ai/u/Dino_Fancellu)\
**Post date:** [July 26, 2025, 11:14am UTC](https://community.perplexity.ai/t/docs-have-non-working-code-completions-create-got-an-unexpected-keyword-argument-search-mode/770/1 "2025-07-26T11:14:12Z")

</div>

## 🐛 Describe the Bug

Example code doesn’t take search\_mode, OpenAI rejects it  
Error: Completions.create() got an unexpected keyword argument ‘search\_mode’

## ✅ Expected Behavior

docs.perplexity.ai/guides/chat-completions-guide

Docs should have working code!

## ❌ Actual Behavior

Error: Completions.create() got an unexpected keyword argument ‘search\_mode’

## Working code

I cannot give you working code as you stop me posting \>2 links, which includes ANY urls in the code!!! I’m only here because you shut down the api\_discussion github

The answer is to use extra\_body

```python
 extra_body={
        "search_mode": "web",
        "search_domain_filter": ["government.gov", "nature.com", "science.org"],
        "search_recency_filter": "month",
        "return_citations": True
    }

```

---

<div class="post-metadata">

**Author:** ![vikvang](https://avatars.discourse-cdn.com/v4/letter/v/67e7ee/32.png) [@vikvang](https://community.perplexity.ai/u/vikvang)\
**Post date:** [July 29, 2025, 8:05pm UTC](https://community.perplexity.ai/t/docs-have-non-working-code-completions-create-got-an-unexpected-keyword-argument-search-mode/770/2 "2025-07-29T20:05:14Z")

</div>

Thank you for bringing this up! We just pushed a fix to the docs.
