Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Document AI unterstützt das Hinzufügen benutzerdefinierter Labels oder Schlüssel/Wert-Paare als Metadaten, die an den Prozessor für ProcessDocument- und BatchProcessDocuments-Anfragen gesendet werden.
Diese Metadaten zur Anfrage (zusammen mit den Nutzungsdaten, z. B. Anzahl der Seiten) werden an das Cloud Billing-System weitergeleitet. Es wird im Abrechnungssystem ausgefüllt, wo Sie Ihre Abrechnungsgebühren durch Filtern nach diesen Metadaten-Labels aufschlüsseln können.
Anwendungsfall
Ein wichtiger Anwendungsfall für Labels sind Kunden, die Dokumentverarbeitungsdienste für viele Kunden anbieten. Ein einzelnes Projekt kann für mehrere Kunden verwendet werden.
Zu Abrechnungszwecken ist es wichtig, bestimmte Anfragen ihren jeweiligen Kunden zuzuordnen. Hier kommen diese Metadaten-Labels ins Spiel. Sie dienen zum Filtern von Berichten in Google Cloud.
Anforderungen an Labels
Die Labels, die auf eine Anfrage angewendet werden, müssen die folgenden Anforderungen erfüllen:
Jede Anfrage kann bis zu 64 Labels haben.
Jedes Label muss ein Schlüssel/Wert-Paar sein.
Schlüssel haben eine Mindestlänge von einem Zeichen und eine maximale Länge von 63 Zeichen und dürfen nicht leer sein. Werte dürfen leer sein und haben eine maximale Länge von 63 Zeichen.
Schlüssel und Werte enthalten nur Kleinbuchstaben, Ziffern, Unterstriche und Bindestriche. Alle Zeichen müssen UTF-8-codiert sein. Internationale Zeichen sind zulässig.
Der Schlüsselabschnitt eines Labels muss innerhalb einer einzelnen Anfrage eindeutig sein. Beispiel: {'country':'india'} ist zulässig, {'country':'india','country':'sweden'} ist jedoch nicht zulässig.
Schlüssel müssen mit einem Kleinbuchstaben oder einem internationalen Zeichen beginnen.
Verwendung mit API
Das Sync Process-Codebeispiel zeigt, wie Sie eine Anfrage mit einem Label an einen Prozessor senden.
Wählen Sie in der Konsole links oben das Menü und dann im Drop-down-Menü Abrechnung aus. Wenn Sie mehrere Rechnungskonten haben, wird eine Seite angezeigt, auf der Sie aufgefordert werden, eine Auswahl zu treffen. Wählen Sie Zum verknüpften Rechnungskonto aus.
Wählen Sie auf der Seite „Abrechnung“ im linken Navigationsbereich die Option Berichte aus.
Verwenden Sie die Filter im rechten Bereich, um die Nutzung von Anfragen zu prüfen.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-04 (UTC)."],[[["\u003cp\u003eDocument AI allows adding custom metadata labels (key-value pairs) to \u003ccode\u003eProcessDocument\u003c/code\u003e and \u003ccode\u003eBatchProcessDocuments\u003c/code\u003e requests.\u003c/p\u003e\n"],["\u003cp\u003eThese metadata labels are forwarded to the Cloud Billing system, enabling users to filter and break down billing charges based on these labels.\u003c/p\u003e\n"],["\u003cp\u003eEach request can have up to 64 labels, and each label consists of a key and a value, both of which have character and length constraints.\u003c/p\u003e\n"],["\u003cp\u003eLabels are particularly useful for customers managing document processing services for multiple clients within a single project, as they facilitate the association of specific requests with their respective clients for billing purposes.\u003c/p\u003e\n"],["\u003cp\u003eThe Cloud Billing console allows for filtering usage reports using these metadata labels, enabling detailed analysis of request activity.\u003c/p\u003e\n"]]],[],null,["# Custom metadata labels\n======================\n\nDocument AI supports adding user-defined labels or key-value pairs (KVPs) as metadata\nsent to the processor to [`ProcessDocument`](/document-ai/docs/reference/rest/v1/projects.locations.processors/process), [`BatchProcessDocuments`](/document-ai/docs/reference/rest/v1/projects.locations.processors/batchProcess)\nrequests.\nThis metadata about the request (along with the usage data, like number of pages)\nis forwarded to the Cloud Billing system. It's populated in the billing\nsystem, where you can break down your billing charges by filtering using these metadata labels.\n\nUse case\n--------\n\nAn important use case for labels involves customers who provide document processing\nservices to many clients. A single project can be used for multiple clients.\nFor billing purposes, it's important to associate specific requests with their\nrespective clients. That's where these metadata labels come in. They're for filtering\nreports in Google Cloud.\n\nRequirements for labels\n-----------------------\n\nThe labels applied to a request must meet the following requirements:\n\n- Each request can have multiple labels, up to a maximum of 64.\n- Each label must be a KVP.\n- Keys have a minimum length of 1 character and maximum 63 characters and cannot be empty. Values can be empty and have a maximum length of 63 characters.\n- Keys and values contain only lowercase letters, numeric characters, underscores, and dashes. All characters must use UTF-8 encoding, and international characters are allowed.\n- The key portion of a label must be unique within a single request (for example, `{'country':'india'}` is fine, but `{'country':'india','country':'sweden'}` is not allowed).\n- Keys must start with a lowercase letter or international character.\n\nUsage with API\n--------------\n\nThe `Sync Process` code sample shows you how to send a request to a processor using a label. \n\n curl -X POST \\\n -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n -H \"Content-Type: application/json; charset=utf-8\" \\\n -d @docai_request.json \\\n \"https://us-documentai.googleapis.com/v1/projects/514064100333/locations/us/processors/3bb61571a9731982:process\"\n\nSample Request \n\n {\n \"skipHumanReview\": true,\n \"rawDocument\": {\n \"mimeType\": \"application/pdf\",\n \"content\" : \"PDF/IMAGE CONTENT\"\n },\n \"labels\": {\"country\": \"india\" },\n \"processOptions\": {\n \"individualPageSelector\" : {\n \"pages\": [1]\n }\n }\n }\n\nThe `Async Process` code sample shows you how to send a request to a processor using a label. \n\n curl -X POST \\\n -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n -H \"Content-Type: application/json; charset=utf-8\" \\\n -d @batch_docai_request.json \\\n \"https://us-documentai.googleapis.com/v1/projects/514064100333/locations/us/processors/3bb61571a9731982:batchProcess\"\n\nSample Request \n\n {\n \"inputDocuments\": {\n \"gcsPrefix\": {\n \"gcsUriPrefix\": \"gs://atul_dai_test/ravi/GCS_DWH_work_flows_docs/Small_pdf/\"\n }\n },\n \"documentOutputConfig\": {\n \"gcsOutputConfig\": {\n \"gcsUri\": \"gs://atul_dai_test/ravi/GCS_DWH_work_flows_docs/test/docai_config/\"\n }\n },\n \"labels\": {\"country\": \"india\" },\n \"skipHumanReview\": true\n }\n\n### Pricing report\n\nYou can use these labels to view request usage.\n\n1. Go to the [Cloud Billing console](https://console.cloud.google.com/billing).\n\n2. From the console, select the **Menu** at the upper left, and select **Billing** from the drop-down. If you have multiple billing accounts\n a page appears that asks you to make a selection. Select **Go to linked billing account**.\n\n3. From the billing page, select **Reports** in the left-hand navigation pane.\n\n4. Use the filters in the right-hand pane to check usage of requests."]]