Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Document AI supporta l'aggiunta di etichette o coppie chiave-valore (KVP) definite dall'utente come metadati
inviati al processore per le richieste di ProcessDocument e BatchProcessDocuments.
Questi metadati sulla richiesta (insieme ai dati di utilizzo, come il numero di pagine) vengono inoltrati al sistema di fatturazione Cloud. Viene compilato nel sistema di fatturazione, dove puoi suddividere i costi di fatturazione filtrando in base a queste etichette dei metadati.
Caso d'uso
Un caso d'uso importante per le etichette riguarda i clienti che forniscono servizi di elaborazione dei documenti a molti clienti. Un singolo progetto può essere utilizzato per più clienti.
Ai fini della fatturazione, è importante associare richieste specifiche ai rispettivi clienti. È qui che entrano in gioco queste etichette dei metadati. Servono per filtrare
i report in Google Cloud.
Requisiti per le etichette
Le etichette applicate a una richiesta devono soddisfare i seguenti requisiti:
Ogni richiesta può avere più etichette, fino a un massimo di 64.
Ogni etichetta deve essere una coppia chiave-valore.
Le chiavi hanno una lunghezza minima di 1 carattere e massima di 63 caratteri e non possono essere vuote. I valori possono essere vuoti e avere una lunghezza massima di 63 caratteri.
Chiavi e valori contengono solo lettere minuscole, caratteri numerici, trattini bassi e trattini. Tutti i caratteri devono utilizzare la codifica UTF-8 e sono consentiti i caratteri internazionali.
La parte della chiave di un'etichetta deve essere univoca all'interno di una singola richiesta (ad esempio, {'country':'india'} va bene, ma {'country':'india','country':'sweden'} non è consentito).
Le chiavi devono iniziare con una lettera minuscola o un carattere internazionale.
Utilizzo con l'API
L'esempio di codice Sync Process mostra come inviare una richiesta a un processore utilizzando un'etichetta.
Nella console, seleziona il menu in alto a sinistra e seleziona Fatturazione dal menu a discesa. Se hai più account di fatturazione,
viene visualizzata una pagina che ti chiede di effettuare una selezione. Seleziona Vai all'account di fatturazione collegato.
Nella pagina di fatturazione, seleziona Report nel riquadro di navigazione a sinistra.
Utilizza i filtri nel riquadro a destra per controllare l'utilizzo delle richieste.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 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."]]