> For the complete documentation index, see [llms.txt](https://docs.graphite-note.com/graphite-note-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.graphite-note.com/graphite-note-documentation/rest-api/model-info-api/code-examples.md).

# Code Examples

### **Python code example**

1. We use the requests library to send a GET request to the /model-info endpoint.
2. We pass the Authorization header with a valid token.
3. Since this is a GET request, no body payload is required.
4. We handle any HTTP exceptions using raise\_for\_status() and basic exception catching.

```
import requests

# Replace {model-code} with your specific model code
url = "https://app.graphite-note.com/api/model/fetch-model-info/{model-code}"

# Insert your Graphite Note tenant token
headers = {
    "Authorization": "Bearer YOUR-TENANT-TOKEN"
}

try:
    response = requests.get(url, headers=headers)
    response.raise_for_status()  # Raises an exception for 4XX/5XX errors

    # Parse JSON response
    data = response.json()
    print("Model Info Retrieved:")
    print(data)
except requests.exceptions.RequestException as e:
    print(f"An error occurred: {e}")
```

***

### **PHP Code Example**

1. We use cURL in PHP to send a GET request to the /model-info endpoint.
2. We set the Authorization header with a bearer token.
3. No request body is needed.
4. We parse the JSON response if the request is successful (HTTP 200 OK). Otherwise, we handle the error.

```
<?php
// Replace {model-code} with your specific model code
$url = "https://app.graphite-note.com/api/model/fetch-model-info/{model-code}";

// Insert your Graphite Note tenant token
$headers = [
    "Authorization: Bearer YOUR-TENANT-TOKEN"
];

// Initialize cURL
$ch = curl_init($url);

// Configure cURL options
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// Execute the GET request
$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);

// Close the connection
curl_close($ch);

// Handle the response
if ($http_code === 200) {
    $data = json_decode($response, true);
    echo "Model Info Retrieved:\n";
    print_r($data);
} else {
    echo "Error: HTTP status code $http_code\n";
    echo $response;
}
?>
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.graphite-note.com/graphite-note-documentation/rest-api/model-info-api/code-examples.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
