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

# Extract Vietnamese National ID Card

POST https://api.staple.io/v1/documents/extract/vid
Content-Type: multipart/form-data

Extract the structured data from a document using the Vietnamese ID Card model in Staple. The document would NOT be left in the queue specified for any further manipulation.

Reference: https://docs.staple.ai/api-reference/v1/documents/extract-vietnamese-national-id-card

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: v1
  version: 1.0.0
paths:
  /v1/documents/extract/vid:
    post:
      operationId: extractVietnameseNationalIdCard
      summary: Extract Vietnamese National ID Card
      description: >-
        Extract the structured data from a document using the Vietnamese ID Card
        model in Staple. The document would NOT be left in the queue specified
        for any further manipulation.
      tags:
        - documents
      parameters:
        - name: x-api-key
          in: header
          description: API key issued by Staple.
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/Documents_extractVietnameseNationalIdCard_Response_200
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                files:
                  type: string
                  format: binary
                  description: File to upload
              required:
                - files
servers:
  - url: https://api.staple.io
    description: https://api.staple.io
components:
  schemas:
    Documents_extractVietnameseNationalIdCard_Response_200:
      type: object
      properties: {}
      description: Empty response body
      title: Documents_extractVietnameseNationalIdCard_Response_200
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: API key issued by Staple.
    bearerAuth:
      type: http
      scheme: bearer
      description: JWT obtained from the login endpoint.

```

## Examples



**Request**

```json
{
  "files": "<file: string>"
}
```

**Response**

```json
{
  "BigBoxes": [
    {
      "box": [
        427,
        40,
        1104,
        336,
        765.5,
        188,
        "CỘNG HÒA XÃ HỘI CHỦ NGHĨA VIỆT HAI\nĐộc lập-Tự do-Hạnh phúc ,\nGIẤY CHỨNG MINH NHÂN DÂN\n351515941\nSŐT\nNGÔ THỊ YẾN LY\n"
      ],
      "page": 0
    },
    {
      "box": [
        386,
        416,
        1158,
        743,
        772,
        579.5,
        "1980\nSinh ngày...\nPhú Mỹ\nNguyên quán:\nPhú Tân , An Giang ,\nPhú He a\nNơi ĐKHK thường trú :\nPhú Mỹ , Phú Tân , An Giang\n"
      ],
      "page": 0
    },
    {
      "box": [
        58,
        870,
        204,
        907,
        131,
        888.5,
        "Dân tộc:.\n"
      ],
      "page": 0
    },
    {
      "box": [
        342,
        857,
        436,
        898,
        389,
        877.5,
        "Kinh\n"
      ],
      "page": 0
    },
    {
      "box": [
        588,
        845,
        1054,
        1003,
        821,
        924,
        "Hòa Hảo\nTôn giáo:\nDẤU VẾT RIÊNG VÀ DI HÌNH\n"
      ],
      "page": 0
    },
    {
      "box": [
        468,
        978,
        438,
        1189,
        453,
        1083.5,
        ""
      ],
      "page": 0
    },
    {
      "box": [
        504,
        1016,
        1093,
        1152,
        798.5,
        1084,
        "Sẹo tròn 0,3cm c2cm sau cánh\nmũi phải\n"
      ],
      "page": 0
    },
    {
      "box": [
        488,
        1188,
        1116,
        1303,
        802,
        1245.5,
        "12 tháng 10 năm 2017\nNgày\nGIÁM ĐỐC CA TỈNH AN GIANG\n"
      ],
      "page": 0
    },
    {
      "box": [
        468,
        1291,
        438,
        1501,
        453,
        1396,
        ""
      ],
      "page": 0
    },
    {
      "box": [
        637,
        1470,
        975,
        1538,
        806,
        1504,
        "Bici Bi Egy\n"
      ],
      "page": 0
    }
  ],
  "DOB": {
    "UICategory": "Personal Information",
    "UIName": "Date of Birth",
    "matches": [
      {
        "keyword": [
          389,
          440,
          526,
          488,
          457,
          464,
          "Sinh ngày"
        ],
        "match": "1980",
        "matchmulti": null,
        "page": 0,
        "value": [
          816,
          429,
          907,
          468,
          861.5,
          448.5,
          "1980"
        ]
      }
    ]
  },
  "DetectedText": "CỘNG HÒA XÃ HỘI CHỦ NGHĨA VIỆT HAI Độc lập-Tự do-Hạnh phúc , GIẤY CHỨNG MINH NHÂN DÂN SŐT 351515941 NGÔ THỊ YẾN LY 1980 Sinh ngày ... Phú Mỹ Nguyên quán: Phú Tân , An Giang , Phú He a Nơi ĐKHK thường trú : Phú Mỹ , Phú Tân , An Giang Dân tộc:. Kinh Tôn giáo: Hòa Hảo DẤU VẾT RIÊNG VÀ DI HÌNH Sẹo tròn 0,3cm c2cm sau cánh mũi phải Ngày 12 tháng 10 năm 2017 GIÁM ĐỐC CA TỈNH AN GIANG Bici Bi Egy ",
  "DocSize": [
    [
      1583,
      1200,
      3
    ]
  ],
  "Domicile": {
    "UICategory": "Personal Information",
    "UIName": "Current Address",
    "matches": [
      {
        "keyword": [
          386,
          505,
          618,
          548,
          502,
          526.5,
          "Nguyên quán:"
        ],
        "match": "Phú Mỹ Phú Tân , An Giang",
        "matchmulti": null,
        "page": 0,
        "value": [
          670,
          487,
          976,
          537,
          823,
          512,
          "Phú Mỹ\nPhú Tân , An Giang ,"
        ]
      }
    ]
  },
  "ExpiryDate": {
    "UICategory": "Card Information",
    "UIName": "Expiry Date",
    "matches": [
      {
        "keyword": null,
        "match": null,
        "page": null,
        "value": null
      }
    ]
  },
  "Gender": {
    "UICategory": "Personal Information",
    "UIName": "Gender",
    "matches": [
      {
        "keyword": null,
        "match": null,
        "page": null,
        "value": null
      }
    ]
  },
  "IdNumber": {
    "UICategory": "Card Information",
    "UIName": "ID Number",
    "matches": [
      {
        "keyword": null,
        "match": "351515941",
        "matchmulti": null,
        "page": 0,
        "value": [
          645,
          206,
          930,
          260,
          787.5,
          233,
          "351515941"
        ]
      }
    ]
  },
  "IssueDate": {
    "UICategory": "Card Information",
    "UIName": "Issue Date",
    "matches": [
      {
        "keyword": null,
        "match": "12",
        "page": null,
        "value": null
      }
    ]
  },
  "IssueMonth": {
    "UICategory": "Card Information",
    "UIName": "Issue Month",
    "matches": [
      {
        "keyword": null,
        "match": "10",
        "page": null,
        "value": null
      }
    ]
  },
  "IssueYear": {
    "UICategory": "Card Information",
    "UIName": "Issue Year",
    "matches": [
      {
        "keyword": null,
        "match": "2017",
        "page": null,
        "value": null
      }
    ]
  },
  "Name": {
    "UICategory": "Personal Information",
    "UIName": "Full Name",
    "matches": [
      {
        "keyword": null,
        "match": "NGÔ THỊ YẾN LY",
        "matchmulti": null,
        "page": 0,
        "value": [
          635,
          271,
          1051,
          334,
          843,
          302.5,
          "NGÔ THỊ YẾN LY"
        ]
      }
    ]
  },
  "Nationality": {
    "UICategory": "Personal Information",
    "UIName": "Nationality",
    "matches": [
      {
        "keyword": null,
        "match": null,
        "page": null,
        "value": null
      }
    ]
  },
  "PermanentAddress": {
    "UICategory": "Personal Information",
    "UIName": "Permanent Address",
    "matches": [
      {
        "keyword": [
          382,
          642,
          735,
          681,
          558.5,
          661.5,
          "Nơi ĐKHK thường trú :"
        ],
        "match": "Phú He a Phú Mỹ , Phú Tân , An Giang",
        "matchmulti": null,
        "page": 0,
        "value": [
          581,
          625,
          1044,
          668,
          812.5,
          646.5,
          "Phú He a\nPhú Mỹ , Phú Tân , An Giang"
        ]
      }
    ]
  },
  "SmallBoxes": [
    {
      "box": [
        427,
        40,
        1106,
        94,
        766.5,
        67,
        "CỘNG HÒA XÃ HỘI CHỦ NGHĨA VIỆT HAI"
      ],
      "page": 0
    },
    {
      "box": [
        556,
        85,
        990,
        130,
        773,
        107.5,
        "Độc lập-Tự do-Hạnh phúc ,"
      ],
      "page": 0
    },
    {
      "box": [
        446,
        140,
        1103,
        193,
        774.5,
        166.5,
        "GIẤY CHỨNG MINH NHÂN DÂN"
      ],
      "page": 0
    },
    {
      "box": [
        510,
        207,
        598,
        261,
        554,
        234,
        "SŐT"
      ],
      "page": 0
    },
    {
      "box": [
        645,
        206,
        930,
        260,
        787.5,
        233,
        "351515941"
      ],
      "page": 0
    },
    {
      "box": [
        635,
        271,
        1051,
        334,
        843,
        302.5,
        "NGÔ THỊ YẾN LY"
      ],
      "page": 0
    },
    {
      "box": [
        816,
        429,
        907,
        468,
        861.5,
        448.5,
        "1980"
      ],
      "page": 0
    },
    {
      "box": [
        389,
        440,
        526,
        488,
        457,
        464,
        "Sinh ngày"
      ],
      "page": 0
    },
    {
      "box": [
        526,
        440,
        572,
        488,
        549,
        464,
        "..."
      ],
      "page": 0
    },
    {
      "box": [
        796,
        487,
        976,
        537,
        886,
        512,
        "Phú Mỹ"
      ],
      "page": 0
    },
    {
      "box": [
        386,
        505,
        618,
        548,
        502,
        526.5,
        "Nguyên quán:"
      ],
      "page": 0
    },
    {
      "box": [
        670,
        558,
        1069,
        617,
        869.5,
        587.5,
        "Phú Tân , An Giang ,"
      ],
      "page": 0
    },
    {
      "box": [
        868,
        625,
        1044,
        668,
        956,
        646.5,
        "Phú He a"
      ],
      "page": 0
    },
    {
      "box": [
        382,
        642,
        735,
        681,
        558.5,
        661.5,
        "Nơi ĐKHK thường trú :"
      ],
      "page": 0
    },
    {
      "box": [
        581,
        681,
        1158,
        741,
        869.5,
        711,
        "Phú Mỹ , Phú Tân , An Giang"
      ],
      "page": 0
    },
    {
      "box": [
        58,
        870,
        204,
        907,
        131,
        888.5,
        "Dân tộc:."
      ],
      "page": 0
    },
    {
      "box": [
        342,
        857,
        436,
        898,
        389,
        877.5,
        "Kinh"
      ],
      "page": 0
    },
    {
      "box": [
        587,
        874,
        741,
        921,
        664,
        897.5,
        "Tôn giáo:"
      ],
      "page": 0
    },
    {
      "box": [
        850,
        863,
        1025,
        900,
        937.5,
        881.5,
        "Hòa Hảo"
      ],
      "page": 0
    },
    {
      "box": [
        604,
        943,
        1055,
        986,
        829.5,
        964.5,
        "DẤU VẾT RIÊNG VÀ DI HÌNH"
      ],
      "page": 0
    },
    {
      "box": [
        504,
        1021,
        1095,
        1066,
        799.5,
        1043.5,
        "Sẹo tròn 0,3cm c2cm sau cánh"
      ],
      "page": 0
    },
    {
      "box": [
        505,
        1089,
        679,
        1147,
        592,
        1118,
        "mũi phải"
      ],
      "page": 0
    },
    {
      "box": [
        512,
        1192,
        586,
        1248,
        549,
        1220,
        "Ngày"
      ],
      "page": 0
    },
    {
      "box": [
        629,
        1183,
        1089,
        1246,
        859,
        1214.5,
        "12 tháng 10 năm 2017"
      ],
      "page": 0
    },
    {
      "box": [
        489,
        1239,
        1116,
        1309,
        802.5,
        1274,
        "GIÁM ĐỐC CA TỈNH AN GIANG"
      ],
      "page": 0
    },
    {
      "box": [
        637,
        1467,
        975,
        1541,
        806,
        1504,
        "Bici Bi Egy"
      ],
      "page": 0
    }
  ]
}
```

**SDK Code**

```python Extract Vietnamese National ID Card
import requests

url = "https://api.staple.io/v1/documents/extract/vid"

files = { "files": "open('string', 'rb')" }
headers = {"x-api-key": "<apiKey>"}

response = requests.post(url, files=files, headers=headers)

print(response.json())
```

```javascript Extract Vietnamese National ID Card
const url = 'https://api.staple.io/v1/documents/extract/vid';
const form = new FormData();
form.append('files', 'string');

const options = {method: 'POST', headers: {'x-api-key': '<apiKey>'}};

options.body = form;

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

```go Extract Vietnamese National ID Card
package main

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

func main() {

	url := "https://api.staple.io/v1/documents/extract/vid"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n")

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

	req.Header.Add("x-api-key", "<apiKey>")

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

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

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

}
```

```ruby Extract Vietnamese National ID Card
require 'uri'
require 'net/http'

url = URI("https://api.staple.io/v1/documents/extract/vid")

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

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n"

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

```java Extract Vietnamese National ID Card
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.staple.io/v1/documents/extract/vid")
  .header("x-api-key", "<apiKey>")
  .body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n")
  .asString();
```

```php Extract Vietnamese National ID Card
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.staple.io/v1/documents/extract/vid', [
  'multipart' => [
    [
        'name' => 'files',
        'filename' => 'string',
        'contents' => null
    ]
  ]
  'headers' => [
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Extract Vietnamese National ID Card
using RestSharp;

var client = new RestClient("https://api.staple.io/v1/documents/extract/vid");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddParameter("undefined", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Extract Vietnamese National ID Card
import Foundation

let headers = ["x-api-key": "<apiKey>"]
let parameters = [
  [
    "name": "files",
    "fileName": "string"
  ]
]

let boundary = "---011000010111000001101001"

var body = ""
var error: NSError? = nil
for param in parameters {
  let paramName = param["name"]!
  body += "--\(boundary)\r\n"
  body += "Content-Disposition:form-data; name=\"\(paramName)\""
  if let filename = param["fileName"] {
    let contentType = param["content-type"]!
    let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8)
    if (error != nil) {
      print(error as Any)
    }
    body += "; filename=\"\(filename)\"\r\n"
    body += "Content-Type: \(contentType)\r\n\r\n"
    body += fileContent
  } else if let paramValue = param["value"] {
    body += "\r\n\r\n\(paramValue)"
  }
}

let request = NSMutableURLRequest(url: NSURL(string: "https://api.staple.io/v1/documents/extract/vid")! 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()
```