# resolveCodes

**Identifier:** `wikidata_resolveCodes`

**Provider:** [Wikidata](https://kirha.com/providers/wikidata.md)

Resolve human-readable names to Wikidata Q-codes (entities) and P-codes (properties) in a single batch call. This is the essential first step before building any SPARQL query — never guess codes. Pass a list of entity names (people, places, organizations, concepts) and/or property names (e.g., 'date of birth', 'occupation', 'country of citizenship') and get back flat arrays of matching Q-codes and P-codes ready to pipe into `searchWikidata`.Typical workflow: resolveCodes → feed `entityIds` and `propertyIds` into searchWikidata along with the question.

## Run it with the CLI

```bash
kirha tools run wikidata_resolveCodes \
  --input '{}'
```

`--input` takes a JSON object that matches the input schema. Pass `--input -` to read it from stdin.

## Call it over HTTP

```bash
curl https://api.kirha.com/tools/v1/execute \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'Authorization: **********' \
  --data '{
  "tool_name": "wikidata_resolveCodes",
  "input": {}
}'
```

Replace the stars with an API key from https://app.kirha.com/api-keys.

## Input schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "properties": {
    "entities": {
      "description": "Entity names to resolve to Q-codes (e.g., ['Paris', 'Albert Einstein', 'Nobel Prize in Physics'])",
      "items": {
        "minLength": 1,
        "type": "string"
      },
      "type": "array"
    },
    "language": {
      "default": "en",
      "description": "Language for entity search",
      "maxLength": 3,
      "minLength": 2,
      "type": "string"
    },
    "properties": {
      "description": "Property names to resolve to P-codes (e.g., ['date of birth', 'country of citizenship', 'occupation'])",
      "items": {
        "minLength": 1,
        "type": "string"
      },
      "type": "array"
    }
  },
  "type": "object"
}
```

## Output schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "context": {
      "type": "string"
    },
    "entities": {
      "items": {
        "additionalProperties": false,
        "properties": {
          "hits": {
            "items": {
              "additionalProperties": false,
              "properties": {
                "description": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "id": {
                  "type": "string"
                },
                "label": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "query": {
            "type": "string"
          }
        },
        "required": [
          "query",
          "hits"
        ],
        "type": "object"
      },
      "type": "array"
    },
    "entityIds": {
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "properties": {
      "items": {
        "additionalProperties": false,
        "properties": {
          "hits": {
            "items": {
              "additionalProperties": false,
              "properties": {
                "datatype": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "id": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "label",
                "description",
                "datatype"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "query": {
            "type": "string"
          }
        },
        "required": [
          "query",
          "hits"
        ],
        "type": "object"
      },
      "type": "array"
    },
    "propertyIds": {
      "items": {
        "type": "string"
      },
      "type": "array"
    }
  },
  "required": [
    "context",
    "entityIds",
    "propertyIds",
    "entities",
    "properties"
  ],
  "type": "object"
}
```

## Related tools

Other Wikidata tools that this tool refers to, or that refer to it.

- [`searchWikidata`](https://kirha.com/providers/wikidata/searchWikidata.md)

-----

[All Wikidata tools](https://kirha.com/providers/wikidata.md) · [< Back to tools list](https://kirha.com/tools.md)