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

# Scan Egyptian Tax ID card

POST https://api.vlenseg.com/v1/ocr/tax_id_card
Content-Type: application/json

Extracts company name, legal form, tax number, activity and activity code, address, dates, and factory ID from an Egyptian Tax ID card image. For file upload instead of base64, use `POST /v1/ocr/tax_id_card/file`.

Requires the Tax ID OCR service address to be configured in server settings (and the service restarted) before this endpoint is available.

Reference: https://docs.vlenseg.com/api-reference/vlens-api/ocr/post-ocr-tax-id-card

## Authentication

- `ApiKey` header (required) — Static API key issued to your tenant. Required on every request.
- `Authorization` header (bearer token, required) — End-user JWT from registration or login. Required for verification, signing, and user-scoped operations.

## Servers

- `https://api.vlenseg.com` (Production, default)
- `https://api.vlens.co` (Staging)

## Request

### Body (application/json)

This endpoint expects an OcrImageRequest.

- `image` (string, required) — Base64-encoded JPEG or PNG. Max 3 MB.
- `transaction_id` (string, optional) — Group multiple steps into one transaction. Omit to start a new one.
- `client_transaction_id` (string, optional) — Your own reference ID.
- `country` (string, optional, default: EGY) — ISO country code. Defaults to `EGY`.
- `getExtractedData` (boolean, optional, default: false) — Include the full extracted fields in the response.

## Response

### 200

- `services` (OcrServices, optional) — Per-service check results attached to every OCR response.
- `data` (map from string to any, optional) — Document-specific extracted fields.
- `error_code` (integer, optional, nullable)
- `error_message` (string, optional, nullable)

## Types

### OcrServices

Per-service check results attached to every OCR response.

- `validations` (OcrServicesValidations, optional, nullable)
- `spoofing` (OcrServicesSpoofing, optional, nullable)
- `classification` (OcrServicesClassification, optional, nullable)
- `liveness` (boolean, optional, nullable) — `true` when the submitted face frames are from a live person.
- `AML` (OcrServicesAml, optional, nullable)
- `SRC` (OcrServicesSrc, optional, nullable)

### OcrServicesValidations

- `validation_errors` (list of OcrServicesValidationsValidationErrorsItems, optional)

### OcrServicesSpoofing

- `fake` (boolean, optional)

### OcrServicesClassification

- `doc_type` (string, optional) — Detected document type, e.g. `national_id`, `passport`, `driving_license`.

### OcrServicesAml

### OcrServicesSrc

### OcrServicesValidationsValidationErrorsItems

- `field` (string, optional)
- `value` (string, optional)
- `errors` (list of OcrServicesValidationsValidationErrorsItemsErrorsItems, optional)

### OcrServicesValidationsValidationErrorsItemsErrorsItems

- `code` (integer, optional)
- `message` (string, optional)

## Examples

**Request**

```json
{
  "image": "<base64>",
  "getExtractedData": true
}
```

**Response**

```json
{
  "services": {
    "validations": {
      "validation_errors": [
        {
          "field": "string",
          "value": "string",
          "errors": [
            {
              "code": 1,
              "message": "string"
            }
          ]
        }
      ]
    },
    "spoofing": {
      "fake": true
    },
    "classification": {
      "doc_type": "string"
    },
    "liveness": true,
    "AML": {},
    "SRC": {}
  },
  "data": {},
  "error_code": 1,
  "error_message": "string"
}
```

**SDK Code**

```python
import requests

url = "https://api.vlenseg.com/v1/ocr/tax_id_card"

payload = {
    "image": "<base64>",
    "getExtractedData": True
}
headers = {
    "ApiKey": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.vlenseg.com/v1/ocr/tax_id_card';
const options = {
  method: 'POST',
  headers: {ApiKey: '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"image":"<base64>","getExtractedData":true}'
};

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

```go
package main

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

func main() {

	url := "https://api.vlenseg.com/v1/ocr/tax_id_card"

	payload := strings.NewReader("{\n  \"image\": \"<base64>\",\n  \"getExtractedData\": true\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("ApiKey", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

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

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

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

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.vlenseg.com/v1/ocr/tax_id_card")

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

request = Net::HTTP::Post.new(url)
request["ApiKey"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"image\": \"<base64>\",\n  \"getExtractedData\": true\n}"

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

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.vlenseg.com/v1/ocr/tax_id_card")
  .header("ApiKey", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"image\": \"<base64>\",\n  \"getExtractedData\": true\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.vlenseg.com/v1/ocr/tax_id_card', [
  'body' => '{
  "image": "<base64>",
  "getExtractedData": true
}',
  'headers' => [
    'ApiKey' => '<apiKey>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.vlenseg.com/v1/ocr/tax_id_card");
var request = new RestRequest(Method.POST);
request.AddHeader("ApiKey", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"image\": \"<base64>\",\n  \"getExtractedData\": true\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "ApiKey": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "image": "<base64>",
  "getExtractedData": true
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.vlenseg.com/v1/ocr/tax_id_card")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```