# Getting started with Python

### Request code

```python
import requests

API_KEY = "<REPLACE_WITH_YOUR_KEY>"
API_ENDPOINT = "https://api.craft.co/v1/query"
GRAPHQL_QUERY = """
    query getCompany($domain: String!) {
        company(domain: $domain) {
            locations {
                city
                country
            }
        }
    }
"""

request_headers= { "x-craft-api-key": API_KEY }
request_data = {
    "query": GRAPHQL_QUERY,
    "variables": { "domain": "meta.com" }
}

response = requests.post(API_ENDPOINT, json=request_data, headers=request_headers, timeout=30)
response_data = response.json()

print(response_data)
```

Make sure to replace `<REPLACE_WITH_YOUR_KEY>` with your unique API key.

### Response

The above command returns JSON structured like this:

```javascript
{
  "data": {
    "company": {
      "locations": [
        {
          "city": "Tokyo",
          "country": "JP"
        },
        {
          "city": "Ottawa",
          "country": "CA"
        },
        {
          "city": "Jakarta",
          "country": "ID"
        },
       ... 
      ]
    }
  }
}
```

#### **Read more**

* [Query basic company info](/company-data-api/data-points/basic-company-information.md)
* [Query financials](/company-data-api/data-points/financials.md)
* [Query operating data](/company-data-api/data-points/operating-data.md)
* [Query human capital data](/company-data-api/data-points/human-capital.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.craft.co/company-data-api/getting-started/data-api-python.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
