Skip to content

Responses API with background: true not returning sources from web_search tool #1676

@ng-plentisoft

Description

@ng-plentisoft

Confirm this is a Node library issue and not an underlying OpenAI API issue

  • This is an issue with the Node library

Describe the bug

When calling the openai.responses.create using the web_search tool call with the background flag set to true, the response did not contain sources from the web_search object.

Expected:

{
      "id": "ws_xxx",
      "type": "web_search_call",
      "status": "completed",
      "action": {
        "type": "search",
        "query": "the_query",
        "sources": [
          {
            "type": "url",
            "url": "https://wordpress.org/plugins/gopublish-publish-from-google-docs-to-any-site/"
          },
          {
            "type": "url",
            "url": "https://wordpress.com/plugins/muzaara-google-content-api-data-feed"
          },
          {
            "type": "url",
            "url": "https://wordpress.org/plugins/docswrite/"
          },
          {
            "type": "url",
            "url": "https://wordpress.org/plugins/sheetlink/"
          },
          {
            "type": "url",
            "url": "https://wordpress.org/plugins/create-post-by-google-document/"
          },
          {
            "type": "url",
            "url": "https://www.dochub.com/en/integrations/crm-system/try-marketmuses-integration-with-dochub-to-save-time-and-effort"
          }
        ]
      }
    }

Got:

{
      "id": "ws_xxx",
      "type": "web_search_call",
      "status": "completed",
      "action": {
        "type": "search",
        "query": "the_query"
    }

To Reproduce

  1. call the openai.responses.create() with web_search tool and background: true configured
  2. use the openai.responses.retrieve(responseId, { include: ["web_search_call.action.sources"], }) to get the response

Code snippets

const response = await openai.responses.create({
    model: "gpt-5-mini",
    input: [
      {
        role: "developer",
        content: "",
      },
      {
        role: "user",
        content:
          "Which content optimization APIs plug into popular CMSs, document editors, and site builders for local SEO workflows?",
      },
    ],
    text: {
      format: {
        type: "text",
      },
      verbosity: "low",
    },
    reasoning: {
      effort: "low",
      summary: "auto",
    },
    tools: [
      {
        type: "web_search",
        filters: null,
        search_context_size: "low",
        user_location: {
          type: "approximate",
          city: null,
          country: null,
          region: null,
          timezone: null,
        },
      },
    ],
    store: true,
    background: false,
    include: ["web_search_call.action.sources"],
  });

OS

macOS

Node version

Node v22

Library version

openai v6.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions