> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.phonic.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.phonic.ai/_mcp/server.

# Get

GET https://api.phonic.ai/v1/extraction_schemas/{nameOrId}

Returns an extraction schema by name or ID.

Reference: https://docs.phonic.ai/api-reference/extraction-schemas/get

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication header of the form `Bearer <PHONIC_API_KEY>`. Manage your API keys [here](https://phonic.co/api-keys).

## Request

### Path parameters

- `nameOrId` (string, required) — The name or the ID of the extraction schema to get.

### Query parameters

- `project` (string, optional, default: main) — The name of the project containing the extraction schema. Only used when `nameOrId` is a name.

## Response

### 200

Success response

- `extraction_schema` (ExtractionSchema, required)

## Errors

### 404 Not Found Error

Extraction schema not found

- `error` (BasicErrorError, optional)

## Types

### ExtractionSchema

- `id` (string, required) — The ID of the extraction schema.
- `name` (string, required) — The name of the extraction schema.
- `prompt` (string, required) — Instructions for how to extract data from conversations.
- `fields` (list of ExtractionField, required) — Array of field definitions specifying what data to extract.

### BasicErrorError

- `message` (string, required) — Error message
- `code` (string, optional) — Error code

### ExtractionField

- `name` (string, required) — The field name.
- `type` (enum, required) — The field type.
  - Allowed values: `string`, `int`, `float`, `bool`, `string[]`, `int[]`, `float[]`, `bool[]`
- `description` (string, required, nullable) — Description of the field. May be null, but the property must be present.

## Examples

**Response**

```json
{
  "extraction_schema": {
    "id": "conv_extract_schema_c818e617-59f9-4f43-936e-ca8a794f9ccf",
    "name": "Appointment details",
    "prompt": "Dates should be in `9 Apr 2025` format. Prices should be in $150.00 format.",
    "fields": [
      {
        "name": "Date",
        "type": "string",
        "description": "The date of the appointment"
      },
      {
        "name": "Copay",
        "type": "string",
        "description": "Amount of money the patient pays for the appointment"
      },
      {
        "name": "Confirmed as booked",
        "type": "bool",
        "description": "Is the appointment confirmed as booked?"
      }
    ]
  }
}
```

**SDK Code**

```python Get extraction schema response
import requests

url = "https://api.phonic.ai/v1/extraction_schemas/nameOrId"

querystring = {"project":"main"}

headers = {"Authorization": "Bearer <apiKey>"}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())
```

```javascript Get extraction schema response
const url = 'https://api.phonic.ai/v1/extraction_schemas/nameOrId?project=main';
const options = {method: 'GET', headers: {Authorization: 'Bearer <apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Get extraction schema response
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.phonic.ai/v1/extraction_schemas/nameOrId?project=main"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Get extraction schema response
require 'uri'
require 'net/http'

url = URI("https://api.phonic.ai/v1/extraction_schemas/nameOrId?project=main")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <apiKey>'

response = http.request(request)
puts response.read_body
```

```java Get extraction schema response
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.phonic.ai/v1/extraction_schemas/nameOrId?project=main")
  .header("Authorization", "Bearer <apiKey>")
  .asString();
```

```php Get extraction schema response
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.phonic.ai/v1/extraction_schemas/nameOrId?project=main', [
  'headers' => [
    'Authorization' => 'Bearer <apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Get extraction schema response
using RestSharp;

var client = new RestClient("https://api.phonic.ai/v1/extraction_schemas/nameOrId?project=main");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <apiKey>");
IRestResponse response = client.Execute(request);
```

```swift Get extraction schema response
import Foundation

let headers = ["Authorization": "Bearer <apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.phonic.ai/v1/extraction_schemas/nameOrId?project=main")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```