client.list_contents(...) -> SyncPager[ContentsCompact, ContentsPage]
-
-
-
List the records the account keeps, newest first, free. Each item is a
ContentsCompact: the record's id, outcome, source and dates, with no text, no map, no model work and no cost, and itsexecutionas stored.Use it to see which pages the account already has before fetching one again;
get_contentsreads one record whole. Every filter you send must match. The list does not move any record'sexpires_at.What it costs. The key needs
contents:read. The call is free. The answer is200withContentsPage.Paging.
page_sizefrom 1, default 50, maximum 200; a value above the maximum is lowered with the noticepage_size_loweredand never refused; a value below 1 is refusedbound.page_tokenis opaque, bound to its query, alive 24 hours;next_page_tokenis absent on the last page, and a page that carries it holds at least one record. A changed filter between pages,page_sizeexcepted, or an unknown, expired or another list's token, is400 page-token-invalidwithchange.fieldnamingpage_token: drop the token and start again. A record made while you page may make an item repeat; when you merge pages, keep one entry perid.Refused before any work. A value outside its set or range,
page_sizeabove its maximum excepted, which is lowered:400 invalid-request,not_allowedorbound, each with where it is. Arun_idof the wrong form:400 invalid-request,syntax; an unknown run:400 invalid-request,not_allowed, since a run is a setting of the key and not a resource here. A token of another list:400 page-token-invalid. An unknown query parameter:400 invalid-request,unknown_field.Notices this operation makes.
page_size_lowered,version_retiring.Problem types.
- 400
invalid-request, The request is invalid;page-token-invalid, The page token is invalid. - 401
unauthorized, The key is missing or rejected. - 403
insufficient-scope, The key lacks a scope this call needs. - 429
rate-limit-exceeded, The rate limit is exceeded;concurrency-limit-exceeded, Too many calls are in flight. - 500
internal-error, The service failed. - 503
overloaded, The service is overloaded.
- 400
-
-
-
from getclean import GetClean from getclean.environment import GetCleanEnvironment client = GetClean( environment=GetCleanEnvironment.PRODUCTION, ) client.list_contents( url="https://example.com/*", carrier="web", run_id="run_default", )
-
-
-
url:
typing.Optional[str]— Only records whosesource.urlequals it, or starts with it when it ends in*, the one place a*may stand; the scheme and the host are compared in lower case. At most 2,048 characters. Default none.
-
carrier:
typing.Optional[str]— Only records of this kind of source:web, a live page;archive, an archive's copy read underas_of_date;upload, bytes you sent. An open set. Default none.
-
run_id:
typing.Optional[str]— Only records of this run, an existing run of the key. Default none.
-
page_size:
typing.Optional[int]— At most this many records on the page, from 1; default 50; the maximum, 200, stands inLimits.bounds, and a larger value is lowered with the noticepage_size_lowered.
-
page_token:
typing.Optional[str]— The next page, as the last answer'snext_page_tokengave it; opaque, at most 1,024 characters, never built by the caller. Default none, the first page.
-
request_options:
typing.Optional[RequestOptions]— Request-specific configuration.
-
-
client.fetch_contents(...) -> Contents
-
-
-
Fetch a web page or a document at a URL. You get its main content with the structure intact, in the formats you ask for, the map of its sections, the facts of the source, a fingerprint and the price, as one record that is kept for later reads.
The record is kept 48 hours after its last call and at most 30 days from its making, and every later question about it, through
get_contents,get_section,list_blocksandlist_links, is answered from the same copy, free. Useupload_contentsfor a file you hold, or for a long document that must run as a job; usesearchwhen you have a question and no URL yet; useget_contentsto read a record you already have.What it costs. The key needs
contents:fetch, pluscontents:modelwhen you sendjson_schema, setsummaryor sendhighlightswithoutdeterministic_only; getclean decides this from the request before any work, so a missing scope is403before any422. The price is 1contents, plusdocument_pagesandrecognized_pageswhen the URL serves a document, plusmodel_stepsfor each model field that ran, plusscreenshotswhen one was made. Anunchangedanswer bills the same 1contents. A fetch that failed, was refused or needs a person bills nothing.What comes back.
201 Created, withLocationnaming the record, for every outcome kind: a page that could not be read is still a record, whoseoutcomesays what happened and what may work next. The record carries what happened, the notices to read first, when the fetch ran, its fingerprint, the content or the map, the facts of the source and the price.The idempotency key.
Idempotency-Keyis optional here. The same key with the same body returns the first answer again, with this call'srequest_id,expires_atas it stands andreplayedtrue oncost; nothing is billed again. The same key while the first call still runs is409 idempotency-key-in-flight; the same key with another body is422 idempotency-key-reused. A replay whose record was deleted is404 not-foundnaming the deletion.How the text fits
max_characters.- It fits: the text formats come whole; the reason is
whole;truncatedis false. - It does not fit: no text format comes;
sections, the map, comes instead; the reason issections_only;truncatedis true.screenshotandraw_htmlstill come. - It does not fit and a highlight was found: the sections that hold highlights come in document order while they fit; a section larger than what remains is cut at a block edge with its highlighted blocks inside; the map comes too, as with
max_characters: 0, and does not count against the limit; the reason ismatching_sections;truncatedis true;get_sectionhas the rest. max_characters: 0: no text; the map comes; the reason iswhole;truncatedis false;screenshot,raw_htmlandlinksstill come, the links within their cap.- The map always carries level 1 and
s0, however many rows. Deeper levels come one whole level at a time from the top, while their rows fitmax_characters; under0, while the rows number at most 200. The noticesections_cutsays when levels were left out. - Two text formats each carry the whole content, so the answer is twice as long;
max_charactersbounds the content once, and each format carries it. - A sent
max_characterswith no text format bounds nothing and makes the noticefield_not_applicable; the default makes none.links,screenshotandraw_htmlare outside it. - To learn a document's size and price for one
contentsunit, sendmax_characters: 0withmax_costat the smallest call's price: no page is parsed beyond the count and the outline.
The formats.
block_kindsnarrows every format: the text formats andlinkshold only those blocks, andhighlights,json_schemaandsummaryread only those blocks;wholethen means all of them fit;countsstays the page's.scope: whole_pagemakes the blocks, the sections and the counts cover the whole page, andleft_outis[]. A highlight is marked<mark id="h1">…</mark>inmarkdownandhtmland listed inhighlight_idsonblocks; nothing is marked indoclang,links,screenshotorraw_html; with no text returned, thehighlightslist still comes with its ids and places. Every occurrence of a string is a highlight, in document order, at most 50 per call, with the noticehighlights_cutpast that.highlights,json_schemaandsummaryread the whole content, or the chosen blocks, whatevermax_characterssays; the bound limits what is returned, not what they read.summaryis at most 1,500 characters, in the content's language.summaryandschema_valuescarry no link and no image; any a model writes is removed with the noticemodel_link_removed, and a URL value is kept only when it stands in the record's links or text.Each highlight string.
- Found
exact: its words stand in one block, after Unicode normalization and whitespace collapse, case kept. Free. - Found
near: its words stand there after case folding, with ellipses and the punctuation at the ends of words removed, punctuation inside a word kept, pieces in order, and the dotted and dotless i of Turkic scripts folded to one. Free. - Not found verbatim: a model picks the blocks that bear on it,
judged. One model step per call, however many strings needed it. - Not found, and nothing bears on it, or
deterministic_only: the noticehighlight_not_found, one per string. The step's price when a model judged it, free underdeterministic_only.
deterministic_only. Nothing runs whose output could differ between two runs of the same input: highlights are found verbatim only;json_schemaandsummaryare refused asmodel-work-refused, both fields named inviolations; the publisher's kind comes only from what getclean already knows. Text recognition on a scanned page still runs and is listed, since it repeats under one version. A key whose policy forbids model work refusesjson_schemaandsummarywithpolicy-limit-exceededand finds highlights verbatim only;deterministic_only: falseunder such a key ispolicy-limit-exceeded, since a request never loosens the key.baseline_fingerprint. On a page: the page is read in full and its fingerprint compared. If it matches, the answer isunchanged: no text, no highlights, no fill, no summary,formatsechoed[], while the record keeps the content, whichget_contentsreads. On a document at a URL: the bytes are fetched; when a record of your account issued the fingerprint you sent and itsdocument_digestequals the bytes' digest, the answer isunchangedwithout a parse; otherwise the parse runs and bills its pages, and a matching content fingerprint then answersunchanged. If no record of your account issued the fingerprint, you get the noticefingerprint_unknown, and the fetch runs whole at the full price. A fingerprint matches only under the scope, the version, the configuration and the kind of source that made it; one issued under another makes the noticefingerprint_incomparable, naming which, and the fetch runs whole at the full price. A fingerprint of a record no longer kept isfingerprint_unknowntoo, so an agent that comes back after its record expired pays the full price and compares fingerprints itself.as_of_date. The record is an archive copy:source.carrierisarchive,source.archivenames the copy, andsource.archives_consultednames the archives ofLimits.archivesthat answered. The copy is the latest capture at or before 23:59:59 UTC of that day whose archived status was 2xx, so a capture later on that day may come,archive.captured_atshowing when; an agent that needs the state before an event asks for the day before.source.next_capture_atcomes when a later capture exists, so an agent steps forward capture by capture. No such copy isno_history.subject_country,subject_language,screenshotandmax_source_priceare not applied to an archive copy, a notice each.screenshotandraw_html. The screenshot is of the live page only: the whole page at its full width, as PNG, with its digest, by a URL getclean serves for as long as the record lives. It ignoresscopeandblock_kinds. It is taken on a second visit to the page, which may be served another page.raw_htmlis the page's bytes exactly as the server sent them, decompressed, before any script ran, on an archive copy as the archive served them, with their digest, their size and theContent-Typesent; by a URL underretentionhold, inline asdata_base64undernone. It ignoresscope,block_kindsandmax_characters, and it is free. The served bytes and their digest let you show later exactly what the server sent.A document at the URL. It is parsed inside the fetch. Past
wait_secondsthe pages parsed come backpartial,time_capped, with the noticeupload_to_finish; pastmax_costthey come backpartial,cost_capped.pages.countand the outline come even when no page was parsed.Money, country and version.
max_costis reserved at the start against the ceiling: the lowest ofmax_cost, the key's cap, the run's budget, the key's budget and the balance. It is spent in one order, the read of the page or of the document's pages first, thenjson_schema,highlights,summaryandscreenshot. When the ceiling, a budget or the deadline cannot cover everything, the extras are cut from the end, each cut a notice naming the field, and the pages are stopped last, the recordpartial. A run's or a key's budget that stops a parse isbudget_capped, with the noticebudget_cut.max_source_price: getclean pays no site, whatever the value; a site that asks a price endsfailed,payment_required, with the price incost.source_priceand the protocol named in the message.subject_countryis the country the page is read from; a page that says it is not offered there isregion_restricted, and a site that refuses the visitor with a block page isblocked.pinned_version:execution.versionequals it.Fields that do not apply to some sources. Each is a notice
field_not_applicablenaming the field, never a refusal, so a client that always sends a field still works on every source:doclang,screenshot,raw_htmlorscope: whole_pageon a URL that serves a document;recognition_languageson a web page;subject_country,subject_language,screenshotormax_source_pricewithas_of_date;- a sent
max_characterswith no text format; block_kindswith nothing to narrow.
The table under
Contentssays which members each kind of source carries.Refused before any work, every violation of the body reported at once in
violations:scope, aformatsvalue, ablock_kindsvalue orretentionoutside its set:invalid-field,not_allowed.- A duplicate in
formatsorblock_kinds:duplicate. An emptyblock_kindslist:bound; sendformats: []for the facts alone. max_charactersbetween 1 and 999:bound.json_schemaorsummaryunder the request'sdeterministic_only:model-work-refused, both fields named.json_schema,summaryordeterministic_only: falseunder a key whose policy forbids model work:403 policy-limit-exceeded.max_costbelow the smallest call's price:cost-exceeds-cap, withminimum_cap.- A scheme other than http or https, a password in the URL's userinfo, or a malformed
baseline_fingerprint:syntax. - localhost, an address that is not globally reachable, or a port the Fetch standard lists as bad:
destination-refused. - A host outside the key's domain policy, or a URL the key's
policy.refuse_credential_urlsrefuses:403 policy-limit-exceeded. - A
subject_countrygetclean cannot read from:not_allowed, with the countries it can read from inallowed_values. - A
json_schemathat is not valid JSON Schema 2020-12:syntax. One whose root is nottype: object, that has noproperties, or whosepatternneeds backtracking:not_allowed. - An unknown
run_id:not_allowed.retention: holdunder anonepolicy:403 policy-limit-exceeded. - A missing
url:required. Any other bound passed:bound. An unknown field:unknown_field. pinned_versionnot served, never or no longer:version-withdrawn, with the versions served.
The one exclusive pair is
deterministic_onlyagainstjson_schemaandsummary. No dependent field refuses;block_kindswith nothing to narrow is a notice. Every other pair is independent.Notices this operation makes.
highlight_not_found,highlights_cut,sections_cut,links_cut,hidden_text_cut,structured_data_cut,size_limit,conversion_mismatch,ad_blocker_failed,not_settled,unread_region,no_main_content,paywall_declared,redirected,requests_blocked,field_not_applicable,cost_cut,budget_cut,time_cut,step_failed,model_link_removed,recognition_uncertain,tracked_changes,upload_to_finish,fingerprint_incomparable,fingerprint_unknown,marks_not_read,archive_unreachable,default_set_by_policy,version_retiring.content_not_renderedis a published code this version does not make.Problem types.
- 400
invalid-request, The request is invalid. - 401
unauthorized, The key is missing or rejected. - 403
insufficient-scope, The key lacks a scope this call needs;policy-limit-exceeded, The key's policy forbids this;credit-exhausted, The credit is exhausted;run-budget-exhausted, The run's budget is exhausted;key-budget-exhausted, The key's budget is exhausted. - 404
not-found, Not found, on a replay whose record was deleted. - 409
idempotency-key-in-flight, The same request is still running. - 413
body-too-large, The body is too large. - 415
unsupported-media-type, The media type is not supported. - 422
invalid-field, A field is invalid;destination-refused, The destination is refused;model-work-refused, Model work is refused by the request;cost-exceeds-cap, The cost cap is below the smallest call;version-withdrawn, The version is no longer served;idempotency-key-reused, The idempotency key was reused with another body. - 429
rate-limit-exceeded, The rate limit is exceeded;concurrency-limit-exceeded, Too many calls are in flight. - 451
legal-block, Withheld under a legal demand. - 500
internal-error, The service failed. - 503
overloaded, The service is overloaded.
When a record is not delivered.
outcome.messagesays what may work next, and the table underOutcome.reasongives it for every reason. - It fits: the text formats come whole; the reason is
-
-
-
from getclean import GetClean from getclean.environment import GetCleanEnvironment client = GetClean( environment=GetCleanEnvironment.PRODUCTION, ) client.fetch_contents( url="https://example.com/q3", highlights=[ "Revenue rose 12%", "what drove the margin" ], summary=True, )
-
-
-
url:
str— The address to fetch, a page or a document; getclean tells which. Required. http or https, at most 2,048 characters. A scheme other than http or https, or a password in the URL's userinfo, is refusedinvalid-field,syntax; localhost, an address that is not globally reachable or a bad port isdestination-refused; a host outside the key's domain policy ispolicy-limit-exceeded.
-
idempotency_key:
typing.Optional[str]One key per logical call, so a retry is never billed twice.
Optional on this operation; required on
upload_contents,fetch_contents_batchandsearch_batch, where a duplicate would cost the most. The SDKs fill a fresh key when you give none and send the same key on every retry of that call. Give your own key when your program retries across processes, so the second run finds the first answer.The form: 1 to 255 visible ASCII characters, used exactly as sent, so a value written as a quoted Structured Field String keeps its quotes as part of the key. That is a stated departure from the IETF draft
draft-ietf-httpapi-idempotency-key-header, revision 08, which is not yet a standard; this parameter documents the form in full.What a repeated key does:
- The same key with the same body returns the first answer again, with this call's
request_id,expires_atas it stands andreplayedtrue on everycost. Nothing is billed again. - The same key while the first call still runs:
409 idempotency-key-in-flight, withRetry-After. - The same key with another body:
422 idempotency-key-reused.
Answers are stored for 24 hours, per account, for billed answers and running jobs only; a free answer is not stored. A call that may bill is kept in the store from its start, so a second call with its key meets the
409while it runs. - The same key with the same body returns the first answer again, with this call's
-
max_characters:
typing.Optional[int]— The most text to return, in characters.0returns no text but the map of sections and the facts, which is how you see a document's size before paying for its text. Default 20,000;0, or 1,000 to 1,000,000; a value between 1 and 999 is refusedbound.
-
scope:
typing.Optional[Scope]— Which view to return:main, the main content alone, orwhole_page, everything on the page. Defaultmain. A document has one view, sowhole_pageon a document makes the noticefield_not_applicable.
-
formats:
typing.Optional[typing.Sequence[str]]— The formats to return, 0 to 7 of these:markdown, the content as one markdown string;html, as clean HTML;doclang, as DocLang, an XML that keeps each block with its place on the page;json, asBlockobjects;links, every link with its kind;screenshot, a picture of the whole page;raw_html, the page's bytes exactly as served.[]returns the facts only. Default["markdown"]. An open set; a repeated value is refusedduplicate, a value outside the setnot_allowed.doclang,screenshotandraw_htmlapply to a web page only; on a document each makes the noticefield_not_applicable.
-
block_kinds:
typing.Optional[typing.Sequence[str]]— Keep only blocks of these kinds, in every format and in every model step: 1 to 10 oftext,heading,code,math,divider,interactive,table,image,embed,media, an open set. Default: every kind. An empty list is refusedbound. When nothing would use it, no text format, nolinks, nohighlights, nojson_schemaand nosummary, the noticefield_not_applicablesays so.
-
highlights:
typing.Optional[typing.Sequence[str]]— Words or questions to find in the content and mark where they stand, 1 to 5 strings of 1 to 4,000 characters each. Each string is one query, and every place it finds carries its position asquery_index. Default none. Sending this withoutdeterministic_onlyneedscontents:model, since a string may need a model. A string found verbatim costs nothing; the strings a model had to judge cost one model step for the whole call.
-
json_schema:
typing.Optional[typing.Dict[str, typing.Any]]— Your own fields, filled from the content by a model, each value with the words it came from; one model step, needscontents:model. A JSON Schema 2020-12 object whose root istype: objectwithproperties, at most 50 KB. Default none. A schema that is not valid JSON Schema is refusedsyntax; one whose root is nottype: object, that has noproperties, or whosepatternneeds backtracking is refusednot_allowed. Under the request'sdeterministic_onlyit is refusedmodel-work-refused; under a key whose policy forbids model work,policy-limit-exceeded.
-
summary:
typing.Optional[bool]— Have a model write a summary of the content, at most 1,500 characters, in the content's language; one model step, needscontents:model. Default false. Under the request'sdeterministic_onlyit is refusedmodel-work-refused; under a key whose policy forbids model work,policy-limit-exceeded.
-
deterministic_only:
typing.Optional[bool]— Turn off every step whose output could differ between two runs of the same input: no judged highlight, no schema fill, no summary, and the publisher's kind only from what getclean already knows. The text and the ids repeat on every call of the same input under one version in any case; with this on, every other part of the answer repeats too, but for what belongs to the call itself:request_id,fetched_at,expires_at,elapsed_secondsandcost. Text recognition on a scanned page still runs and is listed, since it repeats under one version. Default false. A key whose policy forbids model work makes it true, with the noticedefault_set_by_policy; sending false under such a key ispolicy-limit-exceeded.
-
baseline_fingerprint:
typing.Optional[str]— The fingerprint of a copy you already hold, as a record returned it. When the page still matches it, the answer isunchangedwith no text, at the fetch's price, and you know nothing moved. Default none. A malformed value is refusedsyntax. A fingerprint no record of your account issued makes the noticefingerprint_unknown, and one issued under another scope, version, configuration or kind of source the noticefingerprint_incomparable; in both cases the fetch runs whole.
-
as_of_date:
typing.Optional[datetime.date]— Read the page as an archive kept it on that day: the latest capture at or before the end of the day, UTC. A date not after today in UTC. Default none, the live page. On an archive copy,subject_country,subject_language,screenshotandmax_source_pricedo not apply, a notice each.
-
subject_country:
typing.Optional[str]— The country the page is read from, ISO 3166-1 alpha-2, one of the countries getclean can read from,Limits.exits. Default the key'sdefault_exit. A country getclean cannot read from is refusednot_allowed, with the countries it can read from inallowed_values. On a live page or a document at a URL only.
-
subject_language:
typing.Optional[str]— The language to ask the site for, as itsAccept-Language, a BCP 47 tag of 1 to 35 characters. Default none: getclean sends its usualAccept-Language, whichsource.visitor.languagereports. On a live page or a document at a URL only.
-
recognition_languages:
typing.Optional[typing.Sequence[str]]— The languages to expect on scanned pages, 1 to 10 BCP 47 tags of 1 to 35 characters each, amongLimits.recognition_languages; another is refusednot_allowed. Default detected: the document's declared language, else the language of its text, else the script found on the page. On a document only; on a web page the noticefield_not_applicablesays so.
-
wait_seconds:
typing.Optional[float]— The most seconds this call may work, the read of the page or the document, every model step and the screenshot inside, counted from the moment the work starts; time spent waiting to start is not counted. 5 to 90; default 30. What did not finish by then is cut in the published order with a notice, or the outcome says so.
-
max_cost:
typing.Optional[Money]— The most this call may cost, in the account's currency, reserved at the start against the balance and the budgets. Default the key's cap on one call. A value below the smallest call's price is refusedcost-exceeds-cap, withminimum_cap.
-
max_source_price:
typing.Optional[Money]— The most you would allow getclean to pay a site that asks a price for the page. getclean pays no site, whatever the value: a page that asks a price endspayment_required, with the price incost.source_price. Default none.
-
retention:
typing.Optional[Retention]— How long the record is kept.nonekeeps nothing past this answer, so the screenshot and the raw HTML travel inline;holdkeeps the record 48 hours after its last call, at most 30 days, and is allowed only under aholdpolicy, since a request never loosens the key. Default the key'spolicy.retention.
-
pinned_version:
typing.Optional[str]— The version of getclean to run under, at most 64 characters; it fixes the read configuration and every model step's version with it, andexecution.versionequals it. Default the current version,Limits.current_version. A version not served, never or no longer, isversion-withdrawn, with the versions served.
-
run_id:
typing.Optional[str]— The run the record belongs to, an existing run of the key; a key has one run,run_default. Default the key's default run. An unknown run is refusednot_allowed.
-
metadata:
typing.Optional[typing.Dict[str, str]]— Your own labels, returned on the record as sent and never passed to a site: at most 20 string pairs, keys of 1 to 64 characters, values of 1 to 512. Default none. An empty map is refusedbound.
-
request_options:
typing.Optional[RequestOptions]— Request-specific configuration.
-
-
client.get_contents(...) -> Contents
-
-
-
Read a record you already have, free: the same copy in any format, at any size, under either view, with the model work the fetch made.
Give it the
cnt_id an earlierfetch_contents,upload_contentsorsearchreturned. Nothing is fetched from the web; the answer comes from the copy getclean kept. Usefetch_contentsfor a URL; useget_section,list_blocksandlist_linksto read one part of the record at a time.What it costs. The key needs
contents:read. The call is free, so the record carries nocoston this answer.What comes back.
200withContents. The call moves the record'sexpires_at48 hours ahead, never past 30 days from the record's making.- The record's facts come as stored:
outcome,fetched_at,fingerprint,record_scope,source,pages,execution,retention,screenshot,raw_html, and the fetch'shighlights,summary,schema_valuesandschema_statuses. - This answer's own:
scope, the view delivered;truncated;formats; its notices after the record's own;request_id;expires_at. - Under the record's own view,
counts,hidden_textandleft_outare the record's as stored; under the other view they describe that view. - The text fits or does not fit under this call's
max_charactersasfetch_contentssays;truncatedsays which. The record'soutcomeis never rewritten. - The model work the fetch made comes back free, the marks placed where a highlighted block appears in the text returned. A new question is a call to
highlight_contents,fill_schemaorsummarize_contents. scope: whole_pageon a record fetched undermaingives the whole page from the same read, free. Thefingerprintstays that ofrecord_scope;countscover the page andleft_outis[]; the section and block ids are the whole-page view's, and the fetch's highlights carry that view's ids. A document has one view, sowhole_pageon a document record makes the noticefield_not_applicable.- A record without content, failed, refused or needs a person, comes back as stored; the query's parameters make no notice, since nothing was asked of the text. An
unchangedrecord keeps its content and is answered. doclangon a document that is not HTML is left out with the noticefield_not_applicable.
Refused before any work.
- A value outside its set,
max_charactersbetween 1 and 999, a duplicate or an empty list:400 invalid-request,not_allowed,boundorduplicate, each with where it is. - An id of the wrong kind:
400 invalid-request, before any lookup. - An unknown query parameter:
400 invalid-request,unknown_field.
Notices this operation makes.
sections_cut,links_cut,field_not_applicable,version_retiring, after the record's own notices.Problem types.
- 400
invalid-request, The request is invalid. - 401
unauthorized, The key is missing or rejected. - 403
insufficient-scope, The key lacks a scope this call needs. - 404
not-found, Not found: an unknown or another account's record. - 410
contents-expired, The record has expired: for 30 days after it expired, to the owning account only, withexpired_atandchangenamingfetch_contentsandurl; then404. - 429
rate-limit-exceeded, The rate limit is exceeded;concurrency-limit-exceeded, Too many calls are in flight. - 500
internal-error, The service failed. - 503
overloaded, The service is overloaded.
- The record's facts come as stored:
-
-
-
from getclean import GetClean from getclean.environment import GetCleanEnvironment client = GetClean( environment=GetCleanEnvironment.PRODUCTION, ) client.get_contents( contents_id="cnt_5Gh7cdyeVQ6qoJhBFE31L1", max_characters=200000, formats=[ "markdown" ], )
-
-
-
contents_id:
str— The record to read, acnt_id asfetch_contents,upload_contentsorsearchreturned it.
-
max_characters:
typing.Optional[int]— The most text to return, in characters.0returns no text but the map of sections and the facts. Default 20,000;0, or 1,000 to 1,000,000; a value between 1 and 999 is refusedbound.
-
scope:
typing.Optional[Scope]— Which view to return:main, the main content alone, orwhole_page, everything on the page from the same read. Default the record's own view,record_scope. A document has one view, sowhole_pageon a document record makes the noticefield_not_applicable.
-
formats:
typing.Optional[typing.Union[str, typing.Sequence[str]]]— The formats to return, 1 to 5 of these, one value per repeated key:markdown, the content as one markdown string;html, as clean HTML;doclang, as DocLang, an XML that keeps each block with its place on the page, on a page or an HTML file only;json, asBlockobjects;links, every link with its kind. Defaultmarkdown.screenshotandraw_htmlare not values here; the ones the fetch made come with every answer. An open set; a key sent with an empty value is an empty list, refusedbound, and a repeated value is refusedduplicate.
-
block_kinds:
typing.Optional[typing.Union[str, typing.Sequence[str]]]— Keep only blocks of these kinds, in every format: 1 to 10 oftext,heading,code,math,divider,interactive,table,image,embed,media, an open set, one value per repeated key. Default: every kind.
-
request_options:
typing.Optional[RequestOptions]— Request-specific configuration.
-
-
client.delete_contents(...)
-
-
-
Erase a record before it expires: the record, its screenshot, its raw HTML, its document images, its recognized page images and its stored replays. Later calls on the id answer
404. A retry of the fetch with its idempotency key, within the key's 24 hours, answers404naming the deletion, never a second fetch. A job that points at the record keeps itscontents_id, and that id answers404. A second delete is404.What it costs. The key needs
contents:delete. The call is free. The answer is204 No Content.Refused before any work. An id of the wrong kind:
400 invalid-request, before any lookup. An unknown query parameter:400 invalid-request,unknown_field.Problem types.
- 400
invalid-request, The request is invalid. - 401
unauthorized, The key is missing or rejected. - 403
insufficient-scope, The key lacks a scope this call needs. - 404
not-found, Not found: an unknown or another account's record, or one already erased. - 410
contents-expired, The record has expired: for 30 days after it expired, to the owning account only; then404. - 429
rate-limit-exceeded, The rate limit is exceeded;concurrency-limit-exceeded, Too many calls are in flight. - 500
internal-error, The service failed. - 503
overloaded, The service is overloaded.
- 400
-
-
-
from getclean import GetClean from getclean.environment import GetCleanEnvironment client = GetClean( environment=GetCleanEnvironment.PRODUCTION, ) client.delete_contents( contents_id="cnt_3Fk9abaUhNX7t2eKkgfd3e", )
-
-
-
contents_id:
str— The record to erase, acnt_id.
-
request_options:
typing.Optional[RequestOptions]— Request-specific configuration.
-
-
client.get_section(...) -> SectionContents
-
-
-
Read one section of a record, free: its text when it fits, its own text and the rows of its child sections when it does not, and a page of its text when a cut is needed.
Give it the record's
cnt_id and the section'ssid from the map,sections, which a fetch returns when the text did not fit or whenmax_characterswas0.s0is the text before the first heading; on a page or a document without headings it is the whole text. Useget_contentsfor the whole record; uselist_blocksfor the blocks of a section by kind.What it costs. The key needs
contents:read. The call is free.What comes back.
200withSectionContents: first the record's id, address, fetch time, fingerprint, version and configuration, then its newexpires_at, then the section's row, then its text in the formats asked for, or its child rows.- The section fits
max_characters: its text comes whole in the formats asked;truncatedis false; nosections. - It does not fit and has child sections: its own text before the first child comes, with
sections, the child rows, on this first page only;truncatedis true; nonext_page_token, since each child is read by its own id. - It does not fit and has no children, or its own text alone does not fit: the text is cut at a block edge;
truncatedis true;next_page_tokencontinues it. - One block larger than the bound: the text is cut inside the block, at a row, an item, a line or a sentence edge;
truncatedis true;next_page_tokencontinues it. max_characters: 0: the row and the child rows, no text;truncatedis false.linksare the section's links, narrowed byblock_kinds; they come under0too.- The token binds the other parameters; a change is
400 page-token-invalid. It is alive as long as the record, and a page that carriesnext_page_tokenalways has text.
Refused before any work.
- A value outside its set,
max_charactersbetween 1 and 999, a duplicate or an empty list:400 invalid-request,not_allowed,boundorduplicate, each with where it is. - An id of the wrong kind:
400 invalid-request, before any lookup. - A token of another record, another section or another query:
400 page-token-invalid. - A record that failed, was refused or needs a person:
409 record-without-content,changenamingfetch_contents. - An unknown query parameter:
400 invalid-request,unknown_field.
Notices this operation makes.
sections_cut,links_cut,field_not_applicable,version_retiring, after the record's own notices.Problem types.
- 400
invalid-request, The request is invalid;page-token-invalid, The page token is invalid. - 401
unauthorized, The key is missing or rejected. - 403
insufficient-scope, The key lacks a scope this call needs. - 404
not-found, Not found,change.fieldsayingcontents_idorsection_id. - 409
record-without-content, The record has no content. - 410
contents-expired, The record has expired. - 429
rate-limit-exceeded, The rate limit is exceeded;concurrency-limit-exceeded, Too many calls are in flight. - 500
internal-error, The service failed. - 503
overloaded, The service is overloaded.
- The section fits
-
-
-
from getclean import GetClean from getclean.environment import GetCleanEnvironment client = GetClean( environment=GetCleanEnvironment.PRODUCTION, ) client.get_section( contents_id="cnt_3Fk9abaUhNX7t2eKkgfd3e", section_id="s2", formats=[ "markdown" ], )
-
-
-
contents_id:
str— The record, acnt_id.
-
section_id:
str— The section, ansid of the view asked, as the map's rows name it;s0is the text before the first heading.
-
max_characters:
typing.Optional[int]— The most text to return, in characters.0returns the section's row and its child rows, no text. Default 20,000;0, or 1,000 to 1,000,000; a value between 1 and 999 is refusedbound.
-
scope:
typing.Optional[Scope]— Which view's ids and text:mainorwhole_page. Default the record's own.
-
formats:
typing.Optional[typing.Union[str, typing.Sequence[str]]]— The formats to return, over this section, 1 to 5 of these, one value per repeated key:markdown, the text as one markdown string;html, as clean HTML;doclang, as DocLang, an XML that keeps each block with its place on the page, on a page or an HTML file only;json, asBlockobjects;links, the section's links with their kinds. Defaultmarkdown. An open set; a key sent with an empty value is an empty list, refusedbound, and a repeated value is refusedduplicate.
-
block_kinds:
typing.Optional[typing.Union[str, typing.Sequence[str]]]— Keep only blocks of these kinds, over this section: 1 to 10 oftext,heading,code,math,divider,interactive,table,image,embed,media, an open set, one value per repeated key. Default: every kind.
-
page_token:
typing.Optional[str]— Continues a cut text, as the last answer'snext_page_tokengave it; opaque, at most 1,024 characters, alive as long as the record. Default none.
-
request_options:
typing.Optional[RequestOptions]— Request-specific configuration.
-
-
client.list_blocks(...) -> SyncPager[Block, BlockPage]
-
-
-
List the blocks of a record, free: by kind, by section, by document page or by id, in document order, one page of results at a time.
Give it the record's
cnt_id and the filters you want; every filter you send must match. Each block is the record's ownBlock: its id, kind, section, size and text, a table as its rows and spans, an image as its address and size.block_idsreads the blocks a highlight names byblock_id, so you can read the whole block around a match. Useget_sectionfor a section's text in one piece; useget_contentsfor the whole record.What it costs. The key needs
contents:read. The call is free.What comes back.
200withBlockPage: the record's id and facts, the record's newexpires_at, the blocks, andnext_page_tokenwhile more remain.- A page of results ends before the block that would pass
max_characters, or atpage_sizeblocks, whichever comes first. - One block alone larger than
max_characterscomes whole, alone on its page, with the noticeblock_over_limit. highlight_idsis empty on every block here; the fetch's highlights stand on the record.- No block matching:
200with[]. page_sizeis from 1, default 50, maximum 200; a larger value is lowered with the noticepage_size_lowered, never refused.page_tokenis bound to its query and its record and is alive as long as the record;next_page_tokenis absent on the last page, and a page that carries it has at least one block.
Refused before any work.
- A value outside its set or range, a duplicate or an empty list:
400 invalid-request,not_allowed,boundorduplicate, each with where it is;page_sizeabove its maximum is lowered instead. page_numberon a record withoutpages:400 invalid-request,dependent; abovepages.count:400 invalid-request,bound.block_idswithstart_block_id:400 invalid-request,exclusive.- An id of the wrong kind:
400 invalid-request, before any lookup. - A token of another record or another query:
400 page-token-invalid. - A
section_id, ablock_idsvalue or astart_block_idthe record does not hold:404 not-found,change.fieldnaming it. - A record that failed, was refused or needs a person:
409 record-without-content. - An unknown query parameter:
400 invalid-request,unknown_field.
Notices this operation makes.
block_over_limit,page_size_lowered,field_not_applicable,version_retiring, after the record's own notices.Problem types.
- 400
invalid-request, The request is invalid;page-token-invalid, The page token is invalid. - 401
unauthorized, The key is missing or rejected. - 403
insufficient-scope, The key lacks a scope this call needs. - 404
not-found, Not found,change.fieldsayingcontents_id,section_id,block_idsorstart_block_id. - 409
record-without-content, The record has no content. - 410
contents-expired, The record has expired. - 429
rate-limit-exceeded, The rate limit is exceeded;concurrency-limit-exceeded, Too many calls are in flight. - 500
internal-error, The service failed. - 503
overloaded, The service is overloaded.
- A page of results ends before the block that would pass
-
-
-
from getclean import GetClean from getclean.environment import GetCleanEnvironment client = GetClean( environment=GetCleanEnvironment.PRODUCTION, ) client.list_blocks( contents_id="cnt_3Fk9abaUhNX7t2eKkgfd3e", block_kinds=[ "table" ], section_id="s2", block_ids=[ "b7" ], )
-
-
-
contents_id:
str— The record, acnt_id.
-
block_kinds:
typing.Optional[typing.Union[str, typing.Sequence[str]]]— Keep only blocks of these kinds: 1 to 10 oftext,heading,code,math,divider,interactive,table,image,embed,media, an open set, one value per repeated key. Default: every kind.
-
section_id:
typing.Optional[str]— Keep only the blocks of this section and of the sections under it, ansid from the map. Default none.
-
page_number:
typing.Optional[int]— Keep only the blocks of this page of a document, from 1 topages.count. Default none. On a record withoutpages, a web page, it is refuseddependent; abovepages.count,bound.
-
block_ids:
typing.Optional[typing.Union[str, typing.Sequence[str]]]— Keep only these blocks, 1 to 50bids, one value per repeated key; the ids a highlight names. Default none. Withstart_block_idit is refusedexclusive.
-
start_block_id:
typing.Optional[str]— Begin the page of results at this block, abid, and read on from there in document order. Default none, the first block. Withblock_idsit is refusedexclusive.
-
scope:
typing.Optional[Scope]— Which view's blocks:mainorwhole_page. Default the record's own.
-
max_characters:
typing.Optional[int]— The most text on one page of results, in characters; the page ends before the block that would pass it. Default 20,000; 1,000 to 1,000,000.
-
page_size:
typing.Optional[int]— At most this many blocks on a page of results, from 1. Default 50; the maximum, 200, stands inLimits.bounds, and a larger value is lowered with the noticepage_size_lowered.
-
page_token:
typing.Optional[str]— The next page, as the last answer'snext_page_tokengave it; opaque, at most 1,024 characters, alive as long as the record. Default none, the first page.
-
request_options:
typing.Optional[RequestOptions]— Request-specific configuration.
-
-
client.list_links(...) -> SyncPager[Link, LinkPage]
-
-
-
List the links of a record, free: every link with its kind and the block and section that hold it, in document order, one page of results at a time, without the 1,000-link cap a fetch puts on
formats: links.Give it the record's
cnt_id and the filters you want; every filter you send must match. Usefetch_contentsto read a linked page; uselist_blocksfor the blocks themselves.What it costs. The key needs
contents:read. The call is free.What comes back.
200withLinkPage: the record's id and facts, the record's newexpires_at, the links, each with its kind and its place, andnext_page_tokenwhile more remain.- The order is the document order of the blocks that hold the links.
kindis read from the address alone, a guess: no request is made for any link, so a link carries no size and no served type.externalcompares the link's host with the final URL's registrable domain; a link without a host,mail,phoneorfragment, is left out under either value of the filter.- No link matching:
200with[]. page_sizeis from 1, default 50, maximum 200; a larger value is lowered with the noticepage_size_lowered, never refused.page_tokenis bound to its query and its record and is alive as long as the record;next_page_tokenis absent on the last page, and a page that carries it has at least one link.
Refused before any work.
- A value outside its set or range, a duplicate or an empty list:
400 invalid-request,not_allowed,boundorduplicate, each with where it is;page_sizeabove its maximum is lowered instead. - An id of the wrong kind:
400 invalid-request, before any lookup. - A token of another record or another query:
400 page-token-invalid. - A
section_idthe record does not hold:404 not-found,change.fieldnaming it. - A record that failed, was refused or needs a person:
409 record-without-content. - An unknown query parameter:
400 invalid-request,unknown_field.
Notices this operation makes.
page_size_lowered,field_not_applicable,version_retiring, after the record's own notices.Problem types.
- 400
invalid-request, The request is invalid;page-token-invalid, The page token is invalid. - 401
unauthorized, The key is missing or rejected. - 403
insufficient-scope, The key lacks a scope this call needs. - 404
not-found, Not found,change.fieldsayingcontents_idorsection_id. - 409
record-without-content, The record has no content. - 410
contents-expired, The record has expired. - 429
rate-limit-exceeded, The rate limit is exceeded;concurrency-limit-exceeded, Too many calls are in flight. - 500
internal-error, The service failed. - 503
overloaded, The service is overloaded.
-
-
-
from getclean import GetClean from getclean.environment import GetCleanEnvironment client = GetClean( environment=GetCleanEnvironment.PRODUCTION, ) client.list_links( contents_id="cnt_3Fk9abaUhNX7t2eKkgfd3e", link_kinds=[ "file" ], section_id="s3", )
-
-
-
contents_id:
str— The record, acnt_id.
-
link_kinds:
typing.Optional[typing.Union[str, typing.Sequence[str]]]— Keep only links of these kinds: 1 to 7 offile, a file such as a PDF;page, another page;fragment, a place inside the same page;mail, an email address;phone, a phone number;feed, an RSS or Atom feed;other, anything else. An open set, one value per repeated key. Default: every kind.
-
external:
typing.Optional[bool]—truekeeps only links that leave the final URL's registrable domain;false, only those that stay. Default none, both. A link without a host is left out under either value.
-
section_id:
typing.Optional[str]— Keep only the links of this section and of the sections under it, ansid from the map. Default none.
-
scope:
typing.Optional[Scope]— Which view's links:mainorwhole_page. Default the record's own.
-
page_size:
typing.Optional[int]— At most this many links on a page of results, from 1. Default 50; the maximum, 200, stands inLimits.bounds, and a larger value is lowered with the noticepage_size_lowered.
-
page_token:
typing.Optional[str]— The next page, as the last answer'snext_page_tokengave it; opaque, at most 1,024 characters, alive as long as the record. Default none, the first page.
-
request_options:
typing.Optional[RequestOptions]— Request-specific configuration.
-
-
client.upload_contents(...) -> ContentsUpload
-
-
-
Read a document you hold, or one at a URL that needs more time than a fetch gives. You get the same record a fetch makes, the content with its structure intact, the map of its sections, the facts of the source, a fingerprint and the price, with
pagessaying how many pages were read, which failed and which were recognized from their image, and the record is kept for later reads.Send the file as the
documentpart, or its address asurl. The parse runs on as a job when it needs more thanwait_seconds: a scanned document takes seconds per page, and stopping early would lose pages, so this call may answer with a job wherefetch_contentsnever does. Usefetch_contentsfor a web page, or for a document at a URL that fits in one wait; useget_contentsto read a record you already have.What it costs. The key needs
contents:fetch, pluscontents:modelwhen you sendjson_schema, setsummaryor sendhighlightswithoutdeterministic_only; getclean decides this from the form before any work. The price is 1contents, plusdocument_pagesfor every page parsed andrecognized_pagesfor every page recognized, plusmodel_stepsfor each model field that ran. A long scan is the most expensive call there is, since each recognized page bills both page units. It is billed when the record becomes final: in the call that answered201, or when the job completes or is canceled with pages done. Anunchangedanswer bills the same 1contents. A parse that failed, was refused or needs a person bills nothing.What comes back.
- The parse finished within
wait_seconds:201 Created,Locationnaming the record, andContentsUploadwithcontentsset, the record with itscost. - The parse goes on:
202 Accepted,Locationnaming the job,Retry-Aftersaying when to read it, andContentsUploadwithjobset.get_jobreads the job, andget_contentsreads the record oncecontents_idis set. - The record is kept 48 hours after its last call and at most 30 days; the job is kept 30 days after its end.
The body.
multipart/form-data, at most 101 MiB, thedocumentpart at most 100 MiB. Every field is a part under its own name.- One of
documentandurlis required; both at once is refusedexclusive, neitherrequired. - A boolean is the text
trueorfalse; a number is decimal text. json_schema,max_cost,max_source_priceandmetadataare JSON parts, read as JSON whateverContent-Typethe part declares.- A list field is one part per value under the field's name.
- An empty value of a scalar field means the same as leaving it out; an empty value of a list field is an empty list, refused
bound. Null cannot be written in a form. - A scalar field sent as two parts is refused
duplicate. A JSON part that does not parse is422 invalid-field,syntax, placeform. - The
documentpart'sfilenameandContent-Typeare hints. The bytes decide the type, amongLimits.document_media_types; where the bytes alone cannot tell, the declared type decides, then the extension, then plain text. Expect: 100-continueis honored. A declaredContent-Lengthpast 101 MiB, and every refusal the method, the path and the headers decide,401,403 insufficient-scopeforcontents:fetch, the400for a missingIdempotency-Key,415and409 idempotency-key-in-flight, is answered before100 Continue. The scope a form field decides,contents:model, is checked once the form is read and before any work. Thedocumentpart's 100 MiB is checked as the part arrives,413.
The idempotency key.
Idempotency-Keyis required here, since a repeated upload would parse and bill the same document twice; without it the call is400 invalid-requestnaming the header. The same key with the same file and fields returns the first answer again, with this call'srequest_id,expires_atas it stands andreplayedtrue oncost; nothing is billed again. The body is compared by its digest over the file and the fields. A retried start with the same key is the same job. The same key while the first call still runs is409 idempotency-key-in-flight; the same key with another body is422 idempotency-key-reused. A replay whose record was deleted is404 not-foundnaming the deletion.What comes back from a document.
- Sections come from the document's own structure; a PDF without one, from its outline, else one row per page; a scan, one row per page.
Section.basissays which. - Blocks are
text,headingandtablewhere the format carries structure;imagefor an embedded image, served at itsurlwith its digest;mathwhere the format carries equations;codefor a source file, one block per file,code_languagefrom the extension. The other kinds occur only in an HTML file, which takes a page's kinds. page_numberandpage_labelstand on every block of a paged format and on none of an unpaged one.pagesis present for every document; on an unpaged format itscountis the text's size in units ofbounds.contents.document_page_characterscharacters, rounded up. A slide is a page.- XML, JSON and YAML keep every key or element name, one
name: valueline per leaf, the top-level members as sections and the nested ones as headings. - A spreadsheet's cells come as their stored displayed values under the workbook's locale, never another; each sheet is a section titled by its name, and its table carries
top_left_cellandformula_cells. - A DOCX keeps its bold, italics and strikethroughs; tracked changes are shown as accepted, with the notice
tracked_changesand the count. A PDF keeps them only where it carries the structure for them; without it, the noticemarks_not_readsays so, and a strikethrough drawn as a line over text is not detected. - A footnote reference stays as
[^n]; the note's block carriesnote_forwhere the format links it; in a PDF without structure a footnote is a text block at the foot of its page. - Tables come with their structure where the format carries it; a table that continues onto later pages is one block with
last_page_number. The tables of a PDF without structure and of a scan come as text. - Recognition runs on every page without a text layer. Each such page stands in
pages.recognizedwith its confidence and a picture of the page;execution.modelslists the steprecognitionwith its version, andlanguage_detectionwhen the languages were detected; a page that yields no word stands infailed_pages; a recognized block carriesconfidence. A recognized page bills onedocument_pagesunit and onerecognized_pagesunit. Handwriting and formulas without equation structure come as flattened text or not at all, with no notice. highlightson recognized text match the recognized words;nearforgives case and end punctuation, and neitherexactnornearforgives a recognition error.- A still image sent as the document, PNG, JPEG, TIFF, WebP or HEIC, is one page without a text layer and is recognized like a scan. A compressed file such as a ZIP, a mailbox file, a saved web archive, an audio or a video file is refused as the record's outcome
unsupported_media_type. - The model steps, the highlight marks, the map's bound and
block_kindswork as onfetch_contents, over the document's content. - An HTML file is read as a page, from its bytes alone: nothing is fetched and nothing is run, so the styles, scripts and images it only points to are not loaded and its main content may differ from what the person saw.
main,left_out,hidden_text, the walls andsign_in_neededapply to it; no screenshot is made. - The fingerprint is the sha-256 over the markdown written from the document's blocks.
source.document_digestis the sha-256 of the bytes, so you can check that the document parsed is the one you hold. - On a file sent as
document,sourcecarriesurlascaptured_urlor not at all; nofinal_urland nostatus_code;redirects[];carrierupload; noaccess_kind;filenameas sent;media_typeas the bytes showed it;title,authors, the dates andlanguageas the document's properties declare them; nopublisher,canonical_urlorarchive;robotsnot_applicable; novisitor.scopeismain, the whole document;hidden_textandleft_outare absent, present on an HTML file. The table underContentssays which members each kind of source carries. - The bytes you sent are deleted when the parse ends; only the record is kept.
Fields that do not apply. Each is a notice
field_not_applicablenaming the field, never a refusal:doclangon a document that is not HTML;max_source_pricewithdocument;block_kindswith nothing to narrow.recognition_languageswith no page to recognize has no effect and makes no notice.url. getclean downloads the document and parses it as an upload, as a job when the parse outliveswait_seconds.source.carrierisweb, andsource.urlandfinal_urlare set. The address and domain rules offetch_contentsapply. A download that fails takes the outcomes of a fetch:not_found,access_denied,rate_limited,server_error,http_error, or a network failure named as RFC 9209 names it. A download that is a web page, a challenge or a sign-in page among them, is a recordrefused,unsupported_media_type, with the message namingfetch_contents: this call reads documents, not pages, and a wall can be told from a page only by reading it as one.baseline_fingerprint. The bytes are checked first: when a record of your account issued the fingerprint and the file'sdocument_digestmatches it, the answer isunchangedwith no parse and no page billed, at this call's price. Otherwise the parse runs and bills its pages, and a content fingerprint that matches then answersunchanged. If no record of your account issued the fingerprint, you get the noticefingerprint_unknown, and the parse runs whole.Money and time.
max_costis reserved at the start. The pages are parsed, and recognized, one by one in order, and every stop keeps the pages done: the parse stops before the page that would pass the ceiling,partial,cost_capped, orbudget_cappedunder a run's or a key's budget. The job's own bound is 30 minutes; past it the record endspartial,time_capped.max_source_priceapplies withurlas on a fetch.The job. It starts with
202,Location,Retry-Afterand the job in the body, stored before the answer is sent.completed:contents_idis set and the record is delivered or partial.failed:problemis set when nothing was made; elsecontents_idis set and the record carriesfailed,refusedorneeds_person.canceledwith pages done: a recordpartial,canceled, the pages kept and billed. With none: no record and nothing billed.costis the units so far on every read, the final figure oncefinished.- The job is kept 30 days after its end, then answers
410 job-expiredfor 30 days to the owning account, then404. The record has its own life, 48 hours after its last call and at most 30 days, so a job may point at a record that has expired.
Refused before any work, every violation of the form reported at once in
violations, placeform:Idempotency-Keyabsent:400 invalid-request.- A body that is not
multipart/form-data, or carries a content coding:415 unsupported-media-type. documentandurlboth present:invalid-field,exclusive; neither:required.captured_urlorcaptured_atwithurl:dependent.captured_urlwith a scheme other than http or https, orcaptured_atthat is not an RFC 3339 instant:syntax.scope,as_of_date,subject_countryorsubject_language, which belong to a page and not to a file:unknown_field.- The
documentpart over 100 MiB:413 body-too-large. - Every rule of
fetch_contentson the fields the two share, with the same kinds:- a
formatsvalue, ablock_kindsvalue orretentionoutside its set:not_allowed; a duplicate value:duplicate; max_charactersbetween 1 and 999, or any other bound passed:bound;json_schemaorsummaryunderdeterministic_only:model-work-refused;json_schema,summaryordeterministic_only: falseunder a key whose policy forbids model work:403 policy-limit-exceeded;max_costbelow the smallest call's price:cost-exceeds-cap;- a malformed
baseline_fingerprint:syntax; ajson_schemathat is not valid JSON Schema:syntax, and one whose root is nottype: object, that has noproperties, or whosepatternneeds backtracking:not_allowed; - an unknown
run_id:not_allowed;retention: holdunder anonepolicy:403 policy-limit-exceeded; an unknown field:unknown_field;pinned_versionnot served:version-withdrawn.
- a
- With
url: a scheme other than http or https, or a password in the userinfo,syntax; localhost, an address that is not globally reachable, or a bad port,destination-refused; a host outside the key's domain policy, or a URL the key's credential policy refuses,403 policy-limit-exceeded.
Notices this operation makes.
highlight_not_found,highlights_cut,sections_cut,links_cut,structured_data_cut,size_limit,conversion_mismatch,field_not_applicable,cost_cut,budget_cut,time_cut,step_failed,model_link_removed,recognition_uncertain,tracked_changes,fingerprint_incomparable,fingerprint_unknown,marks_not_read,default_set_by_policy,version_retiring; on an HTML file alsohidden_text_cut,unread_region,no_main_contentandpaywall_declared; withurlalsoredirected.content_not_renderedis a published code that this version does not make.Problem types.
- 400
invalid-request, The request is invalid. - 401
unauthorized, The key is missing or rejected. - 403
insufficient-scope, The key lacks a scope this call needs;policy-limit-exceeded, The key's policy forbids this;credit-exhausted, The credit is exhausted;run-budget-exhausted, The run's budget is exhausted;key-budget-exhausted, The key's budget is exhausted. - 404
not-found, Not found, on a replay whose record was deleted. - 409
idempotency-key-in-flight, The same request is still running. - 413
body-too-large, The body is too large. - 415
unsupported-media-type, The media type is not supported. - 422
invalid-field, A field is invalid;destination-refused, The destination is refused, withurl;model-work-refused, Model work is refused by the request;cost-exceeds-cap, The cost cap is below the smallest call;version-withdrawn, The version is no longer served;idempotency-key-reused, The idempotency key was reused with another body. - 429
rate-limit-exceeded, The rate limit is exceeded;concurrency-limit-exceeded, Too many calls are in flight. - 451
legal-block, Withheld under a legal demand. - 500
internal-error, The service failed. - 503
overloaded, The service is overloaded.
When a record is not delivered.
outcome.messagesays what may work next, and the table underOutcome.reasongives it for every reason. - The parse finished within
-
-
-
from getclean import GetClean from getclean.environment import GetCleanEnvironment client = GetClean( environment=GetCleanEnvironment.PRODUCTION, ) client.upload_contents( document="minutes.pdf", )
-
-
-
idempotency_key:
typing.Optional[str]One key per logical call, so a retry is never billed twice.
Required on this operation, where a duplicate would cost the most; without it the call is
400 invalid-requestnaming the header. The SDKs fill a fresh key when you give none and send the same key on every retry of that call. Give your own key when your program retries across processes, so the second run finds the first answer.The form: 1 to 255 visible ASCII characters, used exactly as sent, so a value written as a quoted Structured Field String keeps its quotes as part of the key. That is a stated departure from the IETF draft
draft-ietf-httpapi-idempotency-key-header, revision 08, which is not yet a standard; this parameter documents the form in full.What a repeated key does:
- The same key with the same body returns the first answer again, with this call's
request_id, the currentexpires_atandreplayedtrue on everycost. Nothing is billed again. On the upload the body is compared by a digest over the document and the fields, and a retried start with the same key is the same job. - The same key while the first call still runs:
409 idempotency-key-in-flight, withRetry-After. - The same key with another body:
422 idempotency-key-reused.
Answers are stored for 24 hours, per account, for billed answers and running jobs only. A call that may bill is kept in the store from its start, so a second call with its key meets the
409while it runs. - The same key with the same body returns the first answer again, with this call's
-
document:
typing.Optional[core.File]— The file to read, as the one file part, at most 100 MiB, with any media type on the wire. The part'sfilenameandContent-Typeare hints only: the bytes decide the type, amongLimits.document_media_types; where the bytes alone cannot tell, the declared type, then the extension, then plain text. A still image is read as one scanned page. A compressed file such as a ZIP, a mailbox file, a saved web archive, an audio or a video file is refused as the record's outcomeunsupported_media_type. One ofdocumentandurlis required.
-
url:
typing.Optional[str]— Where the file is, http or https, at most 2,048 characters, under the same address and domain rules as a fetch. getclean downloads it and reads it as an upload, as a job when the reading outliveswait_seconds. A URL that serves a web page is a recordrefused,unsupported_media_type, with the message namingfetch_contents. One ofdocumentandurlis required.
-
captured_url:
typing.Optional[str]— The address the page you saved came from, whendocumentis a page you captured yourself, as you state it; recorded assource.urlwithcarrierupload, so the record says where the page was seen. http or https, at most 2,048 characters; a scheme other than http or https is refusedsyntax. Withdocumentonly; withurlit is refuseddependent. Default none.
-
captured_at:
typing.Optional[datetime.datetime]— When you saved the page, as you state it, an RFC 3339 instant, kept in UTC; recorded assource.captured_at. A value that is not an RFC 3339 instant is refusedsyntax. Withdocumentonly; withurlit is refuseddependent. Default none.
-
baseline_fingerprint:
typing.Optional[str]— The fingerprint of a copy you already hold, as a record returned it,sha-256=:…:. The bytes are checked first: when a record of this account issued the fingerprint and the file'sdocument_digestmatches it, the answer isunchangedwith no parse and no page billed, at this call's price. Otherwise the parse runs and bills its pages, and a content fingerprint that matches then answersunchanged. Default none. A malformed value is refusedsyntax; a fingerprint no record of this account issued makes the noticefingerprint_unknown, and the parse runs whole.
-
max_characters:
typing.Optional[int]— The most text to return, in characters.0returns no text but the map of sections and the facts, which is how you see a document's shape before reading its text. Default 20,000;0, or 1,000 to 1,000,000; a value between 1 and 999 is refusedbound.
-
formats:
typing.Optional[typing.Sequence[str]]— The formats to return, 1 to 5 of these, one part per value:markdown, the content as one markdown string;html, as clean HTML;doclang, as DocLang, an XML that keeps each block with its place on the page, on an HTML file only;json, asBlockobjects;links, every link with its kind. Default["markdown"]. A form has no part for an empty list, so a field left out takes its default and a part sent with an empty value is an empty list, refusedbound; the map and the facts alone come bymax_characters: 0.screenshotandraw_htmlare not values here, since an upload reads a file and never a live page. An open set; a repeated value is refusedduplicate, a value outside the setnot_allowed, anddoclangon a document that is not HTML makes the noticefield_not_applicable.
-
block_kinds:
typing.Optional[typing.Sequence[str]]— Keep only blocks of these kinds, in every format and in every model step: 1 to 10 oftext,heading,code,math,divider,interactive,table,image,embed,media, an open set, one part per value. Default: every kind. In a document onlytext,heading,table,image,mathandcodeoccur; an HTML file takes every kind. An empty list is refusedbound, a repeated valueduplicate. When nothing would use it, no text format, nolinks, nohighlights, nojson_schemaand nosummary, the noticefield_not_applicablesays so.
-
highlights:
typing.Optional[typing.Sequence[str]]— Words or questions to find in the content and mark where they stand, as onfetch_contents: 1 to 5 strings of 1 to 4,000 characters each, one part per value. Each string is one query, and every place it finds carries its position asquery_index. Default none. Sending this withoutdeterministic_onlyneedscontents:model, since a string may need a model. A string found verbatim costs nothing; the strings a model had to judge cost one model step for the whole call. On recognized text,exactandnearmatch the recognized words;nearforgives case and end punctuation, and neither forgives a recognition error.
-
json_schema:
typing.Optional[typing.Dict[str, typing.Any]]— Your own fields, filled from the content by a model, each value with the words it came from; one model step, needscontents:model. A JSON part: a JSON Schema 2020-12 object whose root istype: objectwithproperties, at most 50 KB. Default none. A schema that is not valid JSON Schema is refusedsyntax; one whose root is nottype: object, that has noproperties, or whosepatternneeds backtracking is refusednot_allowed. Under the request'sdeterministic_onlyit is refusedmodel-work-refused; under a key whose policy forbids model work,policy-limit-exceeded.
-
summary:
typing.Optional[bool]— Have a model write a summary of the content, at most 1,500 characters, in the content's language; one model step, needscontents:model. Default false. Under the request'sdeterministic_onlyit is refusedmodel-work-refused; under a key whose policy forbids model work,policy-limit-exceeded.
-
deterministic_only:
typing.Optional[bool]— Turn off every step whose output could differ between two runs of the same bytes: no judged highlight, no schema fill, no summary. The text and the ids repeat on every call of the same input under one version in any case; with this on, every other part of the answer repeats too, but for what belongs to the call itself:request_id,fetched_at,expires_at,elapsed_secondsandcost. Text recognition on a page without a text layer still runs and is listed, since it repeats under one version. Default false. A key whose policy forbids model work makes it true, with the noticedefault_set_by_policy; sending false under such a key ispolicy-limit-exceeded.
-
recognition_languages:
typing.Optional[typing.Sequence[str]]— The languages to expect on pages without a text layer, 1 to 10 BCP 47 tags of 1 to 35 characters each, amongLimits.recognition_languages, one part per value; another is refusednot_allowed. Default detected: the document's declared language, else the language of its text, else the script found on the page. With no such page it has no effect and makes no notice.
-
wait_seconds:
typing.Optional[float]— The most seconds this call may work before it answers, counted from the moment the work starts; time spent waiting to start is not counted. A parse that finishes inside it answers201with the record; one that needs more answers202with a job and runs on. 5 to 90; default 30.
-
max_cost:
typing.Optional[Money]— The most this call may cost, aMoneyas a JSON part in the account's currency, reserved at the start against the balance and the budgets. A long scan is the most expensive call there is, since each recognized page bills two page units, so set it with that in mind. Default the key's cap on one call. A value below the smallest call's price is refusedcost-exceeds-cap, withminimum_cap.
-
max_source_price:
typing.Optional[Money]— The most you would allow getclean to pay a site that asks a price for the document aturl, aMoneyas a JSON part; withdocumentit does nothing, the noticefield_not_applicable. getclean pays no site, whatever the value: a site that asks a price endspayment_required, with the price incost.source_price. Default none.
-
retention:
typing.Optional[Retention]— How long the record is kept.nonekeeps nothing past the delivery: when the parse ran as a job, the record waits for the firstget_contents, which is its delivery, and is erased after that answer.holdkeeps the record 48 hours after its last call, at most 30 days, and is allowed only under aholdpolicy, since a request never loosens the key. Default the key'spolicy.retention.
-
pinned_version:
typing.Optional[str]— The version of getclean to run under, at most 64 characters; it fixes how documents are read and how pages are recognized, andexecution.versionequals it. Default the current version,Limits.current_version. A version not served, never or no longer, isversion-withdrawn, with the versions served.
-
run_id:
typing.Optional[str]— The run the record belongs to, an existing run of the key; a key has one run,run_default. Default the key's default run. An unknown run is refusednot_allowed.
-
metadata:
typing.Optional[typing.Dict[str, str]]— Your own labels, a JSON part, returned on the record as sent and never passed to a site: at most 20 string pairs, keys of 1 to 64 characters, values of 1 to 512. Default none. An empty map is refusedbound.
-
request_options:
typing.Optional[RequestOptions]— Request-specific configuration.
-
-
client.list_jobs(...) -> SyncPager[Job, JobPage]
-
-
-
List the account's jobs, newest first, free.
stateandkindfilter them, and every filter you send must match. A job started while you page may make an item repeat; when you merge pages, keep one entry perid.What it costs. The key needs
jobs:read. The call is free. The answer is200withJobPage.Paging.
page_sizefrom 1, default 50, maximum 200, a larger value lowered with the noticepage_size_lowered;page_tokenis opaque, bound to its query, alive 24 hours;next_page_tokenis absent on the last page, and a page that carries it holds at least one job. A changed filter between pages,page_sizeexcepted, or an unknown, expired or another list's token, is400 page-token-invalid.Refused before any work. A value outside its set or range,
page_sizeabove its maximum excepted, which is lowered:400 invalid-request,not_allowedorbound, each with where it is. A token of another list:400 page-token-invalid. An unknown query parameter:400 invalid-request,unknown_field.Notices this operation makes.
page_size_lowered, inJobPage.notices; aJobcarries no notices and no version, so no retirement notice is made here.Problem types.
- 400
invalid-request, The request is invalid;page-token-invalid, The page token is invalid. - 401
unauthorized, The key is missing or rejected. - 403
insufficient-scope, The key lacks a scope this call needs. - 429
rate-limit-exceeded, The rate limit is exceeded;concurrency-limit-exceeded, Too many calls are in flight. - 500
internal-error, The service failed. - 503
overloaded, The service is overloaded.
- 400
-
-
-
from getclean import GetClean from getclean.environment import GetCleanEnvironment client = GetClean( environment=GetCleanEnvironment.PRODUCTION, ) client.list_jobs( state="completed", kind="upload_contents", )
-
-
-
state:
typing.Optional[str]— Only jobs in this state;queued,running,completed,failedorcanceled, the last three final; an open set. Default none.
-
kind:
typing.Optional[str]— Only jobs of this kind,upload_contents, an open set. Default none.
-
page_size:
typing.Optional[int]— At most this many jobs on the page, from 1; default 50; the maximum, 200, stands inLimits.bounds, and a larger value is lowered with the noticepage_size_lowered.
-
page_token:
typing.Optional[str]— The next page, as the last answer'snext_page_tokengave it; opaque, at most 1,024 characters, never built by the caller. Default none, the first page.
-
request_options:
typing.Optional[RequestOptions]— Request-specific configuration.
-
-
client.get_job(...) -> Job
-
-
-
Read a job, or wait for it to finish, free. The answer comes at the final state or when
wait_secondsends, with the job as it stands; it is200when the job failed too, with the failure inside.Retry-Afterandretry_after_secondscome on every answer that is not final. Oncecontents_idis set,get_contentsreads the record;cancel_jobasks the job to stop.What it costs. The key needs
jobs:read. The call is free. The answer is200withJob, never cached. AHEADon this path is answered at once and does not wait.Refused before any work. A value outside its range:
400 invalid-request,bound. An id of the wrong kind:400 invalid-request, before any lookup. An unknown query parameter:400 invalid-request,unknown_field.Problem types.
- 400
invalid-request, The request is invalid. - 401
unauthorized, The key is missing or rejected. - 403
insufficient-scope, The key lacks a scope this call needs. - 404
not-found, Not found: an unknown or another account's job. - 410
job-expired, The job has expired: the job ended more than 30 days ago. The answer comes for 30 more days, to the owning account only, withexpired_atandchangenamingupload_contents; then404. - 429
rate-limit-exceeded, The rate limit is exceeded;concurrency-limit-exceeded, Too many calls are in flight. - 500
internal-error, The service failed. - 503
overloaded, The service is overloaded.
- 400
-
-
-
from getclean import GetClean from getclean.environment import GetCleanEnvironment client = GetClean( environment=GetCleanEnvironment.PRODUCTION, ) client.get_job( job_id="job_8Rt2mqXKclxu58MCwLkSCV", )
-
-
-
job_id:
str— The job, ajob_id asupload_contentsreturned it.
-
wait_seconds:
typing.Optional[float]— The most seconds to wait for the job to finish, 0 to 90; the answer comes at the final state or when the wait ends, with the current state. Default 0, no wait.
-
request_options:
typing.Optional[RequestOptions]— Request-specific configuration.
-
-
client.cancel_job(...) -> Job
-
-
-
Ask a job to stop, free. The answer is
200with the job as it stands; the work may finish before it stops, andRetry-Aftercomes while it still runs, as onget_job. A job already final is unchanged. With pages already parsed the record ispartial,canceled, the pages kept and billed; with none, no record and nothing billed.What it costs. The key needs
jobs:cancel. The call is free. It takes no body; a body sent is refused400 invalid-request.Refused before any work. An id of the wrong kind:
400 invalid-request, before any lookup. A body sent:400 invalid-request. An unknown query parameter:400 invalid-request,unknown_field.Problem types.
- 400
invalid-request, The request is invalid. - 401
unauthorized, The key is missing or rejected. - 403
insufficient-scope, The key lacks a scope this call needs. - 404
not-found, Not found: an unknown or another account's job. - 410
job-expired, The job has expired: the job ended more than 30 days ago; the answer comes for 30 more days, to the owning account only, then404. - 429
rate-limit-exceeded, The rate limit is exceeded;concurrency-limit-exceeded, Too many calls are in flight. - 500
internal-error, The service failed. - 503
overloaded, The service is overloaded.
- 400
-
-
-
from getclean import GetClean from getclean.environment import GetCleanEnvironment client = GetClean( environment=GetCleanEnvironment.PRODUCTION, ) client.cancel_job( job_id="job_3ZYgQAhOBQmM5xiilC8Fj9", )
-
-
-
job_id:
str— The job to stop, ajob_id.
-
request_options:
typing.Optional[RequestOptions]— Request-specific configuration.
-
-
client.fetch_contents_batch(...) -> ContentsBatch
-
-
-
Fetch 1 to 20 pages or documents at their URLs in one call. You get one record per address, kept as a single fetch's is, with a tally first and the sum of the costs last.
Give it the addresses as
items, each with its own few fields, and at the top the fields every item shares. The results come in input order, each a record or the problem that skipped it. Nothing here is atomic: an item that fails or is skipped leaves the others standing. The batch is not a resource, so it has no id, no expiry and noLocation; each record has its own. Usefetch_contentsfor one address; useupload_contentsfor a file you hold. A batch takes at most 20 addresses and no files.What it costs. The key needs
contents:fetch, pluscontents:modelas onfetch_contents, decided over the top fields and every item before any work. The price is the sum of the records' costs, each priced as a fetch, withunitssummed by name. An item that was skipped, or whose record failed, was refused or needs a person, bills nothing.What comes back.
200withContentsBatch:counts, how the items ended;results, in input order;cost, the sum. Every record is kept 48 hours after its last call and at most 30 days.The idempotency key.
Idempotency-Keyis required here, since a repeated batch would fetch and bill every address twice; without it the call is400 invalid-requestnaming the header. The whole answer is stored when at least one record was billed, and the same key with the same body returns it again with this call'srequest_id, every record'sexpires_atas it stands andreplayedtrue on everycost. The same key while the first call still runs is409 idempotency-key-in-flight; the same key with another body is422 idempotency-key-reused. A replay whose record was deleted is404 not-foundnaming the deletion.The bounds.
- The body is at most 4 MiB, enough for 20 items with five 4,000-character highlights each in a script such as Chinese, where a character takes three bytes, JSON escaping included.
max_charactersbounds each record's text as on a fetch.max_total_charactersbounds the whole answer's text, links counted by their url and text: records take their text in input order while it fits in what remains, and a record that would pass it comes assections_onlywith the noticetotal_characters_cut;get_contentsreturns that record's text free unlessretentionisnone. A value belowmax_charactersis allowed.screenshotcounts against neither bound and bills onescreenshotsunit per record that made one;raw_htmlcounts against neither and is free.wait_secondsis each item's own deadline from its own start. Items run in parallel up to the key's concurrency and the rest wait inside the call; the whole call ends atbounds.contents.batch_seconds, and an item not started by then isskippedwith the problemoverloadedandretry_after_secondsset, neverdeadline.
Money.
max_costis the whole call's ceiling, reserved at the start in input order: each item its smallest call, onecontents, abaseline_fingerprintitem too, and the units it asks for by name, the model steps and the screenshot. An item's record carries the ceiling reserved for it ascost.ceiling. An item the remainder cannot cover for its smallest call isskippedwith the problem of the limit that bound it:cost-exceeds-capfor this request'smax_cost,policy-limit-exceededfor the key's cap,credit-exhausted,run-budget-exhaustedorkey-budget-exhausted. What remains of the ceiling is shared by the documents' pages, which spend it as they come; a document stops when it is spent,partial,cost_capped. Inside an item the extras are cut in the orderfetch_contentsgives, each with the noticecost_cut.json_schemaandsummaryrun per record, one model step per record per field.Faults, and whose they are.
- The batch's own shape broken, a missing
url, a bad or repeatedlabel, a malformedbaseline_fingerprint, a bound passed, a misplaced or unknown field:422for the whole call, each violation with its pointer, as/items/3/url. - A top field's rule broken:
422for the whole call, as onfetch_contents. - One item's fault in its address, its domain or a legal demand: that item alone is
skipped, its problem beside it,invalid-field,destination-refused,policy-limit-exceededorlegal-block, and the batch runs. - One item's fault learned from the fetch: that item's record carries the outcome.
- The same URL twice: two fetches, two records.
Refused before any work, every violation of the body reported at once in
violations:- Fewer than 1 or more than 20 items:
invalid-field,bound. - An item without
url:required. - A
labelrepeated:duplicate; one outside its character set or length:syntax,bound. url,label,highlightsorbaseline_fingerprintat the top, or a top-only field inside an item:misplaced.max_total_charactersoutside its range:bound.- Every rule of
fetch_contentson the top fields and on an item's own fields, except the address's own rules, its scheme and userinfo, the destination and the domain policy, which skip that item alone as said above. - An unknown field, at the top or in an item:
unknown_field. Idempotency-Keyabsent:400 invalid-request.
Notices this operation makes. Every notice of
fetch_contents, inside each record;total_characters_cuton a record cut by the whole answer's bound.Problem types. For the whole call:
- 400
invalid-request, The request is invalid. - 401
unauthorized, The key is missing or rejected. - 403
insufficient-scope, The key lacks a scope this call needs;policy-limit-exceeded, The key's policy forbids this;credit-exhausted, The credit is exhausted;run-budget-exhausted, The run's budget is exhausted;key-budget-exhausted, The key's budget is exhausted. - 404
not-found, Not found, on a replay whose record was deleted. - 409
idempotency-key-in-flight, The same request is still running. - 413
body-too-large, The body is too large. - 415
unsupported-media-type, The media type is not supported. - 422
invalid-field, A field is invalid;model-work-refused, Model work is refused by the request;cost-exceeds-cap, The cost cap is below the smallest call;version-withdrawn, The version is no longer served;idempotency-key-reused, The idempotency key was reused with another body. - 429
rate-limit-exceeded, The rate limit is exceeded;concurrency-limit-exceeded, Too many calls are in flight. - 500
internal-error, The service failed. - 503
overloaded, The service is overloaded.
Inside a skipped item, each without
status:invalid-field,destination-refused,policy-limit-exceeded,legal-block,cost-exceeds-cap,credit-exhausted,run-budget-exhausted,key-budget-exhausted,overloaded.When a record is not delivered.
outcome.messagesays what may work next, and the table underOutcome.reasongives it for every reason.
-
-
-
from getclean import GetClean, ContentsBatchItem, Money from getclean.environment import GetCleanEnvironment client = GetClean( environment=GetCleanEnvironment.PRODUCTION, ) client.fetch_contents_batch( items=[ ContentsBatchItem( url="https://a.example/report", label="a", ), ContentsBatchItem( url="https://b.example/filing", label="b", baseline_fingerprint="sha-256=:kw4QGoYGxOYpZ0EZGL+nxMfFUXfrxcp+P0M4EOrEiH4=:", ), ContentsBatchItem( url="http://10.0.0.7/admin", label="c", ) ], max_total_characters=60000, max_cost=Money( amount="0.1000", currency="USD", ), formats=[ "json" ], block_kinds=[ "table" ], )
-
-
-
items:
typing.Sequence[ContentsBatchItem]— The fetches, 1 to 20ContentsBatchItemobjects, answered in this order. Required. The same URL may stand twice and makes two records.
-
idempotency_key:
typing.Optional[str]One key per logical call, so a retry is never billed twice.
Required on this operation, where a duplicate would cost the most; without it the call is
400 invalid-requestnaming the header. The SDKs fill a fresh key when you give none and send the same key on every retry of that call. Give your own key when your program retries across processes, so the second run finds the first answer.The form: 1 to 255 visible ASCII characters, used exactly as sent, so a value written as a quoted Structured Field String keeps its quotes as part of the key. That is a stated departure from the IETF draft
draft-ietf-httpapi-idempotency-key-header, revision 08, which is not yet a standard; this parameter documents the form in full.What a repeated key does:
- The same key with the same body returns the first answer again, with this call's
request_id, the currentexpires_atandreplayedtrue on everycost. Nothing is billed again. On the upload the body is compared by a digest over the document and the fields, and a retried start with the same key is the same job. - The same key while the first call still runs:
409 idempotency-key-in-flight, withRetry-After. - The same key with another body:
422 idempotency-key-reused.
Answers are stored for 24 hours, per account, for billed answers and running jobs only. A call that may bill is kept in the store from its start, so a second call with its key meets the
409while it runs. - The same key with the same body returns the first answer again, with this call's
-
max_characters:
typing.Optional[int]— The most text to return per record, in characters.0returns no text but the map of sections and the facts. Default 20,000;0, or 1,000 to 1,000,000; a value between 1 and 999 is refusedbound.
-
max_total_characters:
typing.Optional[int]— The most text in the whole answer, every record's text and links together, links counted by their url and text. Records take their text in input order while it fits in what remains; a record that would pass it comes assections_onlywith the noticetotal_characters_cut, andget_contentsreturns its text free. Default 200,000; 1,000 to 2,000,000, a value belowmax_charactersallowed.
-
wait_seconds:
typing.Optional[float]— The most seconds each item may work, counted from its own start, as onfetch_contents; the whole call ends atbounds.contents.batch_seconds, and an item not started by then is skipped. 5 to 90; default 30.
-
max_cost:
typing.Optional[Money]— The most the whole call may cost, in the account's currency. It is reserved per item in input order, each item's smallest call and the units it asks for by name, and what remains is one shared sum the documents' pages spend. Default the key's cap on one call. A value below one item's smallest call is refusedcost-exceeds-cap, withminimum_cap.
-
scope:
typing.Optional[Scope]— Which view to return for every item:main, the main content alone, orwhole_page, everything on the page. Defaultmain. A document has one view, sowhole_pageon a document makes the noticefield_not_applicable.
-
formats:
typing.Optional[typing.Sequence[str]]— The formats to return for every item, 0 to 7 of these:markdown, the content as one markdown string;html, as clean HTML;doclang, as DocLang, an XML that keeps each block with its place on the page;json, asBlockobjects;links, every link with its kind;screenshot, a picture of the whole page;raw_html, the page's bytes exactly as served.[]returns the facts only. Default["markdown"]. An open set; a repeated value is refusedduplicate, a value outside the setnot_allowed.doclang,screenshotandraw_htmlapply to a web page only; on a document each makes the noticefield_not_applicable.
-
block_kinds:
typing.Optional[typing.Sequence[str]]— Keep only blocks of these kinds, in every format and in every model step, for every item: 1 to 10 oftext,heading,code,math,divider,interactive,table,image,embed,media, an open set. Default: every kind. An empty list is refusedbound.
-
json_schema:
typing.Optional[typing.Dict[str, typing.Any]]— Your own fields, filled from each record by a model, each value with the words it came from; one model step per record, needscontents:model. As onfetch_contents: a JSON Schema 2020-12 object whose root istype: objectwithproperties, at most 50 KB, refusedsyntaxwhen it is not valid JSON Schema andnot_allowedwhen its root is nottype: object, it has noproperties, or itspatternneeds backtracking;model-work-refusedunderdeterministic_only,policy-limit-exceededunder a key whose policy forbids model work. Default none.
-
summary:
typing.Optional[bool]— Have a model write a summary of each record, at most 1,500 characters, in the content's language, as onfetch_contents; one model step per record, needscontents:model. Default false. Underdeterministic_onlyit is refusedmodel-work-refused; under a key whose policy forbids model work,policy-limit-exceeded.
-
deterministic_only:
typing.Optional[bool]— Turn off, for every item, every step whose output could differ between two runs of the same input, as onfetch_contents: no judged highlight, no schema fill, no summary, and the publisher's kind only from what getclean already knows. Text recognition on a scanned page still runs and is listed, since it repeats under one version. Default false. A key whose policy forbids model work makes it true, with the noticedefault_set_by_policy; sending false under such a key ispolicy-limit-exceeded.
-
as_of_date:
typing.Optional[datetime.date]— Read every page as an archive kept it on that day, the latest capture at or before the end of the day, UTC; an item's ownas_of_dateoverrides it. A date not after today in UTC. Default none, the live pages.
-
subject_country:
typing.Optional[str]— The country every page is read from, ISO 3166-1 alpha-2, one of the countries getclean can read from,Limits.exits; an item's ownsubject_countryoverrides it. Default the key'sdefault_exit. A country getclean cannot read from is refusednot_allowed, with the countries it can read from inallowed_values.
-
subject_language:
typing.Optional[str]— The language to ask every site for, as itsAccept-Language, a BCP 47 tag of 1 to 35 characters; an item's ownsubject_languageoverrides it. Default none: getclean sends its usualAccept-Language, whichsource.visitor.languagereports.
-
recognition_languages:
typing.Optional[typing.Sequence[str]]— The languages to expect on scanned pages, for every item that serves a document: 1 to 10 BCP 47 tags of 1 to 35 characters each, amongLimits.recognition_languages; another is refusednot_allowed. Default detected, as onfetch_contents.
-
max_source_price:
typing.Optional[Money]— The most you would allow getclean to pay a site that asks a price for its page, for every item, as onfetch_contents. getclean pays no site, whatever the value: a page that asks a price ends that recordpayment_required, with the price in itscost.source_price. Default none.
-
retention:
typing.Optional[Retention]— How long every record of the batch is kept,holdornone, as onfetch_contents. Default the key'spolicy.retention;holdis allowed only under aholdpolicy.
-
pinned_version:
typing.Optional[str]— The version of getclean every item runs under, at most 64 characters;execution.versionequals it on every record. Default the current version,Limits.current_version. A version not served, never or no longer, isversion-withdrawn, with the versions served.
-
run_id:
typing.Optional[str]— The run every record belongs to, an existing run of the key. Default the key's default run. An unknown run is refusednot_allowed.
-
metadata:
typing.Optional[typing.Dict[str, str]]— Your own labels, returned on every record as sent and never passed to a site: at most 20 string pairs, keys of 1 to 64 characters, values of 1 to 512. Default none. An empty map is refusedbound.
-
request_options:
typing.Optional[RequestOptions]— Request-specific configuration.
-
-
client.highlight_contents(...) -> ContentsHighlights
-
-
-
Find words or questions in a record you already have and mark where they stand, without fetching again. You get each place with its section and block ids, and, when you ask for text, the sections that hold them, marked. A string found verbatim is free; one a model has to judge costs one model step, once per call however many strings needed it.
What it costs. The key needs
contents:read, andcontents:modelunlessdeterministic_onlyis true, since a string may need a model. Free when every string was found verbatim; 1model_stepswhen any string had to be judged, once per call. The answer is200withContentsHighlights; the call moves the record'sexpires_at48 hours ahead.The idempotency key.
Idempotency-Keyis optional here. A billed answer is stored 24 hours and replayed under the same key and body with this call'srequest_idandreplayedtrue oncost; a free answer is not stored; the same key in flight is409 idempotency-key-in-flight; the same key with another body422 idempotency-key-reused.Each string. Found
exactwhen its words stand in one block, after Unicode normalization and whitespace collapse, case kept;nearwhen they stand there after case folding, with ellipses and the punctuation at the ends of words removed, pieces in order, the dotted and dotless i of Turkic scripts folded to one;judgedwhen not found verbatim and a model picked the blocks that bear on it; not found, and nothing bears on it, ordeterministic_only: the noticehighlight_not_found, one per string. Every occurrence is a highlight, in document order, at most 50, past which the noticehighlights_cutcomes.What comes back.
max_characters: 0: thehighlightslist with ids and places, no text,formatsechoed[]. Above0: the sections holding highlights, in document order while they fit; a section larger than what remains comes cut at a block edge with its highlighted blocks inside;truncatedtrue when the text returned is not the whole content, false when the holding sections are the whole and fit or when nothing was found; the rest throughget_sectionorlist_blockswithblock_ids. The marks are<mark id="h1">…</mark>inmarkdownandhtmlandhighlight_idsonblocks; the record's own text never changes.Verbatim only. Under
deterministic_only, a key whose policy forbids model work, or a ceiling below a model step, the strings are matched verbatim only; this operation is never refused for the key's policy or the ceiling, an explicitdeterministic_only: falseunder such a key excepted,policy-limit-exceededas on the fetch; under a ceiling below the step the miss carries the noticecost_cutorbudget_cutnaminghighlights. A model step that fails or passes its bound,bounds.contents.model_step_seconds, answers200with the verbatim results and the noticestep_failed, not billed.scope: whole_pageon a document record, orblock_kindsthat match no block, is the noticefield_not_applicable; with no block to search nothing is found, nothing is judged, nothing billed.Refused before any work.
doclang,links,screenshotorraw_htmlinformats, or a value outside its set:invalid-field,not_allowed.highlightsmissing:required; an empty list:bound; a duplicate:duplicate.max_charactersbetween 1 and 999, or any other bound passed:bound. An unknown field:unknown_field. A record that failed, was refused or needs a person:409 record-without-content,changenamingfetch_contents. Every violation of the body is reported at once inviolations.Notices this operation makes. The record's own notices first, then
highlight_not_found,highlights_cut,step_failed,cost_cut,budget_cut,default_set_by_policy,field_not_applicable,version_retiring.Problem types. Never a money problem: when the money does not cover the model step, the strings are matched verbatim instead.
- 400
invalid-request, The request is invalid. - 401
unauthorized, The key is missing or rejected. - 403
insufficient-scope, The key lacks a scope this call needs;policy-limit-exceeded, The key's policy forbids this. - 404
not-found, Not found. - 409
record-without-content, The record has no content;idempotency-key-in-flight, The same request is still running. - 410
contents-expired, The record has expired. - 413
body-too-large, The body is too large. - 415
unsupported-media-type, The media type is not supported. - 422
invalid-field, A field is invalid;idempotency-key-reused, The idempotency key was reused with another body. - 429
rate-limit-exceeded, The rate limit is exceeded;concurrency-limit-exceeded, Too many calls are in flight. - 500
internal-error, The service failed. - 503
overloaded, The service is overloaded.
- 400
-
-
-
from getclean import GetClean from getclean.environment import GetCleanEnvironment client = GetClean( environment=GetCleanEnvironment.PRODUCTION, ) client.highlight_contents( contents_id="cnt_3Fk9abaUhNX7t2eKkgfd3e", highlights=[ "Revenue rose 12%", "dividend policy" ], max_characters=0, )
-
-
-
contents_id:
str— The record, acnt_id.
-
highlights:
typing.Sequence[str]— Words or questions to find and mark; each string is one query, numbered byquery_indexin the answer. 1 to 5 strings, each 1 to 4,000 characters; an empty list is refusedbound, a duplicateduplicate. Required.
-
idempotency_key:
typing.Optional[str]One key per logical call, so a retry is never billed twice.
Optional on this operation; required on
upload_contents,fetch_contents_batchandsearch_batch, where a duplicate would cost the most. The SDKs fill a fresh key when you give none and send the same key on every retry of that call. Give your own key when your program retries across processes, so the second run finds the first answer.The form: 1 to 255 visible ASCII characters, used exactly as sent, so a value written as a quoted Structured Field String keeps its quotes as part of the key. That is a stated departure from the IETF draft
draft-ietf-httpapi-idempotency-key-header, revision 08, which is not yet a standard; this parameter documents the form in full.What a repeated key does:
- The same key with the same body returns the first answer again, with this call's
request_id,expires_atas it stands andreplayedtrue on everycost. Nothing is billed again. - The same key while the first call still runs:
409 idempotency-key-in-flight, withRetry-After. - The same key with another body:
422 idempotency-key-reused.
Answers are stored for 24 hours, per account, for billed answers and running jobs only; a free answer is not stored. A call that may bill is kept in the store from its start, so a second call with its key meets the
409while it runs. - The same key with the same body returns the first answer again, with this call's
-
max_characters:
typing.Optional[int]— The most text returned around the highlights, in characters;0means the list of places only.0, or 1,000 to 1,000,000; a value between 1 and 999 is refusedbound. Default 20,000.
-
scope:
typing.Optional[Scope]— Which view is searched,mainorwhole_page. Default the record's own.
-
formats:
typing.Optional[typing.Sequence[str]]— The format of the text returned, when any: 1 to 3 ofmarkdown,html,json;doclang,links,screenshotandraw_htmlare refusednot_allowedhere. Default["markdown"].
-
block_kinds:
typing.Optional[typing.Sequence[str]]— Search and return only these blocks, 1 to 10 oftext,heading,code,math,divider,interactive,table,image,embed,media; an open set. Default: every kind. When none matches, the noticefield_not_applicable.
-
deterministic_only:
typing.Optional[bool]— Find the strings verbatim only: a string not found is the noticehighlight_not_found, and no model judges it. Default false.
-
request_options:
typing.Optional[RequestOptions]— Request-specific configuration.
-
-
client.fill_schema(...) -> SchemaFill
-
-
-
Fill your JSON Schema from a record you already have. You get a value only where the record states it, never a plausible one, with the place and the cited words for each property, and
empty,absentorunreadwhere the record says nothing. It is the same step asfetch_contents'sjson_schema, run on the copy getclean keeps.What it costs. The key needs
contents:model. The price is 1model_steps. The answer is200withSchemaFill; the call moves the record'sexpires_at48 hours ahead.The idempotency key.
Idempotency-Keyis optional here. The billed answer is stored 24 hours and replayed under the same key and body with this call'srequest_idandreplayedtrue oncost; the same key in flight is409 idempotency-key-in-flight; the same key with another body422 idempotency-key-reused.The fill.
schema_statusesis keyed by JSON Pointer, one per property, withtextthe cited words and the place.absentmeans the content kept underscopesays nothing;unreadmeans the place may lie in parts not parsed, not recognized or past a cap, so absence cannot be claimed; an agent that meetsabsentbeside a non-emptyleft_outmay retry underscope: whole_page.schema_valuescarries no link and no image markup; a URL value is kept only when it stands in the record's links or text, otherwise removed with the noticemodel_link_removed. The step is the whole call: a step that gave a bad answer is502 gateway-error, a step that passedbounds.contents.model_step_secondsis504 gateway-timeout, eachretryabletrue and not billed.scope: whole_pageon a document record, orblock_kindsthat match no block, is the noticefield_not_applicable; with no block to read every status isabsentand the step is not billed.Refused before any work.
json_schemamissing:invalid-field,required. A schema that is not valid JSON Schema 2020-12:syntax; one whose root is nottype: object, that has noproperties, or whosepatternneeds backtracking:not_allowed. A value outside its set:not_allowed; a bound passed:bound; an unknown field:unknown_field. A key whose policy forbids model work, or whose cap is below a model step:403 policy-limit-exceeded. A record that failed, was refused or needs a person:409 record-without-content. Every violation of the body is reported at once inviolations.Notices this operation makes. The record's own notices first, then
model_link_removed,field_not_applicable,version_retiring.Problem types.
- 400
invalid-request, The request is invalid. - 401
unauthorized, The key is missing or rejected. - 403
insufficient-scope, The key lacks a scope this call needs;policy-limit-exceeded, The key's policy forbids this;credit-exhausted, The credit is exhausted;run-budget-exhausted, The run's budget is exhausted;key-budget-exhausted, The key's budget is exhausted. - 404
not-found, Not found. - 409
record-without-content, The record has no content;idempotency-key-in-flight, The same request is still running. - 410
contents-expired, The record has expired. - 413
body-too-large, The body is too large. - 415
unsupported-media-type, The media type is not supported. - 422
invalid-field, A field is invalid;idempotency-key-reused, The idempotency key was reused with another body. - 429
rate-limit-exceeded, The rate limit is exceeded;concurrency-limit-exceeded, Too many calls are in flight. - 500
internal-error, The service failed. - 502
gateway-error, A step behind the service failed: the model step gave a bad answer; nothing was billed, and a retry may work. - 503
overloaded, The service is overloaded. - 504
gateway-timeout, A step behind the service timed out: the model step passed its time bound; nothing was billed, and a retry may work.
- 400
-
-
-
from getclean import GetClean from getclean.environment import GetCleanEnvironment client = GetClean( environment=GetCleanEnvironment.PRODUCTION, ) client.fill_schema( contents_id="cnt_3Fk9abaUhNX7t2eKkgfd3e", json_schema={ "type": "object", "properties": {"revenue_growth": {"type": "string"}, "dividend": {"type": "string"}} }, )
-
-
-
contents_id:
str— The record, acnt_id.
-
json_schema:
typing.Dict[str, typing.Any]— The properties to fill, a JSON Schema 2020-12 object whose root istype: objectwithproperties, at most 50 KB; refusedsyntaxwhen it is not valid JSON Schema,not_allowedwhen its root is nottype: object, it has noproperties, or itspatternneeds backtracking. Required.
-
idempotency_key:
typing.Optional[str]One key per logical call, so a retry is never billed twice.
Optional on this operation; required on
upload_contents,fetch_contents_batchandsearch_batch, where a duplicate would cost the most. The SDKs fill a fresh key when you give none and send the same key on every retry of that call. Give your own key when your program retries across processes, so the second run finds the first answer.The form: 1 to 255 visible ASCII characters, used exactly as sent, so a value written as a quoted Structured Field String keeps its quotes as part of the key. That is a stated departure from the IETF draft
draft-ietf-httpapi-idempotency-key-header, revision 08, which is not yet a standard; this parameter documents the form in full.What a repeated key does:
- The same key with the same body returns the first answer again, with this call's
request_id,expires_atas it stands andreplayedtrue on everycost. Nothing is billed again. - The same key while the first call still runs:
409 idempotency-key-in-flight, withRetry-After. - The same key with another body:
422 idempotency-key-reused.
Answers are stored for 24 hours, per account, for billed answers and running jobs only; a free answer is not stored. A call that may bill is kept in the store from its start, so a second call with its key meets the
409while it runs. - The same key with the same body returns the first answer again, with this call's
-
block_kinds:
typing.Optional[typing.Sequence[str]]— Read only these blocks, 1 to 10 oftext,heading,code,math,divider,interactive,table,image,embed,media; an open set. Default: every kind. When none matches, the noticefield_not_applicableand every statusabsent.
-
scope:
typing.Optional[Scope]— Which view is read,mainorwhole_page. Default the record's own.
-
request_options:
typing.Optional[RequestOptions]— Request-specific configuration.
-
-
client.summarize_contents(...) -> ContentsSummary
-
-
-
Have a model write a summary of a record you already have, at most 1,500 characters in the content's language, from the copy getclean keeps. It is the same step as
fetch_contents'ssummary. Usehighlight_contentsto find words andfill_schemato fill fields.What it costs. The key needs
contents:model. The price is 1model_steps. The answer is200withContentsSummary; the call moves the record'sexpires_at48 hours ahead.The idempotency key.
Idempotency-Keyis optional here. The billed answer is stored 24 hours and replayed under the same key and body with this call'srequest_idandreplayedtrue oncost; the same key in flight is409 idempotency-key-in-flight; the same key with another body422 idempotency-key-reused.The summary. At most 1,500 characters, in the content's language; no link and no image markup, any the model writes removed with the notice
model_link_removed. The step is the whole call: a step that gave a bad answer is502 gateway-error, a step that passedbounds.contents.model_step_secondsis504 gateway-timeout, eachretryabletrue and not billed.scope: whole_pageon a document record, orblock_kindsthat match no block, is the noticefield_not_applicable; with no block to read the summary is an empty string and the step is not billed.Refused before any work. A value outside its set:
invalid-field,not_allowed; a bound passed:bound; an unknown field:unknown_field. A key whose policy forbids model work, or whose cap is below a model step:403 policy-limit-exceeded. A record that failed, was refused or needs a person:409 record-without-content. Every violation of the body is reported at once inviolations.Notices this operation makes. The record's own notices first, then
model_link_removed,field_not_applicable,version_retiring.Problem types. The same as
fill_schema.- 400
invalid-request, The request is invalid. - 401
unauthorized, The key is missing or rejected. - 403
insufficient-scope, The key lacks a scope this call needs;policy-limit-exceeded, The key's policy forbids this;credit-exhausted, The credit is exhausted;run-budget-exhausted, The run's budget is exhausted;key-budget-exhausted, The key's budget is exhausted. - 404
not-found, Not found. - 409
record-without-content, The record has no content;idempotency-key-in-flight, The same request is still running. - 410
contents-expired, The record has expired. - 413
body-too-large, The body is too large. - 415
unsupported-media-type, The media type is not supported. - 422
invalid-field, A field is invalid;idempotency-key-reused, The idempotency key was reused with another body. - 429
rate-limit-exceeded, The rate limit is exceeded;concurrency-limit-exceeded, Too many calls are in flight. - 500
internal-error, The service failed. - 502
gateway-error, A step behind the service failed: the model step gave a bad answer; nothing was billed, and a retry may work. - 503
overloaded, The service is overloaded. - 504
gateway-timeout, A step behind the service timed out: the model step passed its time bound; nothing was billed, and a retry may work.
- 400
-
-
-
from getclean import GetClean from getclean.environment import GetCleanEnvironment client = GetClean( environment=GetCleanEnvironment.PRODUCTION, ) client.summarize_contents( contents_id="cnt_3Fk9abaUhNX7t2eKkgfd3e", )
-
-
-
contents_id:
str— The record, acnt_id.
-
idempotency_key:
typing.Optional[str]One key per logical call, so a retry is never billed twice.
Optional on this operation; required on
upload_contents,fetch_contents_batchandsearch_batch, where a duplicate would cost the most. The SDKs fill a fresh key when you give none and send the same key on every retry of that call. Give your own key when your program retries across processes, so the second run finds the first answer.The form: 1 to 255 visible ASCII characters, used exactly as sent, so a value written as a quoted Structured Field String keeps its quotes as part of the key. That is a stated departure from the IETF draft
draft-ietf-httpapi-idempotency-key-header, revision 08, which is not yet a standard; this parameter documents the form in full.What a repeated key does:
- The same key with the same body returns the first answer again, with this call's
request_id,expires_atas it stands andreplayedtrue on everycost. Nothing is billed again. - The same key while the first call still runs:
409 idempotency-key-in-flight, withRetry-After. - The same key with another body:
422 idempotency-key-reused.
Answers are stored for 24 hours, per account, for billed answers and running jobs only; a free answer is not stored. A call that may bill is kept in the store from its start, so a second call with its key meets the
409while it runs. - The same key with the same body returns the first answer again, with this call's
-
block_kinds:
typing.Optional[typing.Sequence[str]]— Summarize only these blocks, 1 to 10 oftext,heading,code,math,divider,interactive,table,image,embed,media; an open set. Default: every kind. When none matches, the noticefield_not_applicableand an empty summary.
-
scope:
typing.Optional[Scope]— Which view is summarized,mainorwhole_page. Default the record's own.
-
request_options:
typing.Optional[RequestOptions]— Request-specific configuration.
-
-
client.compare_contents(...) -> SyncPager[BlockChange, Comparison]
-
-
-
Compare a record you already have with a baseline, block by block and cell by cell, without a model, free. You get whether anything changed, a tally, and each change with both of its sides. The baseline is another record,
baseline_contents_id, or the markdown you kept yourself as a record returned it,baseline_markdownwith itsbaseline_fingerprint. It is aPOSTwith a body that bills nothing and changes nothing but the record'sexpires_at, so it is safe to repeat.What it costs. The key needs
contents:read. The call is free. The answer is200withComparison; the call moves the current record'sexpires_at48 hours ahead. The body is at most 8 MiB, so that a baseline of 1,000,000 characters fits in any script.The comparison.
- A baseline you kept yourself is checked first: the sha-256 of the text, after the same normalization as the fingerprint, must equal
baseline_fingerprint, else422 invalid-field,syntax, namingbaseline_fingerprint. The text is split into blocks by the rules that made it,baseline.verifiedis true, and thebeforesides carry text without ids. - Both sides must share one
execution.versionand onerecord_scope, else422 records-incomparablewithchangenaming which. A difference in the kind of source or the configuration is the noticefingerprint_incomparable, and the comparison runs. A baseline you kept names its version and scope inbaseline_versionandbaseline_scope, or takes the current record's. - The unit is the block. Text is compared after Unicode normalization with the formatting marks removed; tables cell by cell; no model.
changedblocks are paired in order when they are alike above a published similarity;movedis the same text at another position in the block order;addedandremovedare the rest, removed blocks at the place they held. A page number differing alone is no change, and a paragraph that runs across a page break is one block.changedtrue withchanges[]means only inline formatting moved. The same id on both sides ischangedfalse withchanges[].- Two records of different URLs or documents are allowed; you know what you compare.
paywall_declaredis repeated when either side carries it.
Paging.
changesis paged,countsthe whole tally on every page before the rows;page_sizefrom 1, default 50, maximum 200, a larger value lowered with the noticepage_size_lowered;page_tokenbinds the body's other fields,page_sizeincluded; a token of another comparison, or of this one with another body, is400 page-token-invalid.Refused before any work.
baseline_contents_idandbaseline_markdownboth present:invalid-field,exclusive; neither:required;baseline_markdownwithoutbaseline_fingerprintor the reverse:dependent;baseline_versionorbaseline_scopewithbaseline_contents_id:dependent. The text does not hash tobaseline_fingerprint:invalid-field,syntax. A bound passed,page_sizeabove its maximum excepted, which is lowered:bound; an unknown field:unknown_field. Another version or scope:422 records-incomparable,change.fieldnamingbaseline_versionorbaseline_scope,baseline_contents_idfor a baseline that is a record. Either record without content:409 record-without-content,change.fieldnaming the side. A token of another comparison, or of this one with another body:400 page-token-invalid. An id of the wrong kind:400 invalid-request. Every violation of the body is reported at once inviolations.Notices this operation makes.
fingerprint_incomparable,paywall_declared,page_size_lowered,version_retiring.Problem types.
- 400
invalid-request, The request is invalid;page-token-invalid, The page token is invalid. - 401
unauthorized, The key is missing or rejected. - 403
insufficient-scope, The key lacks a scope this call needs. - 404
not-found, Not found,change.fieldsaying which id. - 409
record-without-content, The record has no content. - 410
contents-expired, The record has expired,detailnaming which record. - 413
body-too-large, The body is too large. - 415
unsupported-media-type, The media type is not supported. - 422
invalid-field, A field is invalid;records-incomparable, The records cannot be compared. - 429
rate-limit-exceeded, The rate limit is exceeded;concurrency-limit-exceeded, Too many calls are in flight. - 500
internal-error, The service failed. - 503
overloaded, The service is overloaded.
- A baseline you kept yourself is checked first: the sha-256 of the text, after the same normalization as the fingerprint, must equal
-
-
-
from getclean import GetClean from getclean.environment import GetCleanEnvironment client = GetClean( environment=GetCleanEnvironment.PRODUCTION, ) client.compare_contents( contents_id="cnt_9Zze6X8RDFg2XxyKyLlV5T", baseline_contents_id="cnt_3Fk9abaUhNX7t2eKkgfd3e", )
-
-
-
contents_id:
str— The current record, acnt_id.
-
baseline_contents_id:
typing.Optional[str]— The baseline record, acnt_id kept by the same account. One ofbaseline_contents_idandbaseline_markdownis required; both at once are refusedexclusive.
-
baseline_markdown:
typing.Optional[str]— The markdown you kept, as a record returned it, whole, at most 1,000,000 characters; a partial text cannot be compared, since its hash is checked. Withbaseline_fingerprint, each refuseddependentwithout the other.
-
baseline_fingerprint:
typing.Optional[str]— The fingerprint ofbaseline_markdownas the record returned it; a text that does not hash to it is refusedsyntax.
-
baseline_version:
typing.Optional[str]— Theexecution.versionof the record your text came from, at most 64 characters, so the one-version rule can be checked and the text split by the rules that made it; withbaseline_markdownonly, refuseddependentwithbaseline_contents_id. Default the current record's.
-
baseline_scope:
typing.Optional[Scope]— Therecord_scopeof the record your text came from; withbaseline_markdownonly, refuseddependentwithbaseline_contents_id. Default the current record's.
-
page_size:
typing.Optional[int]— At most this many changes on the page, from 1; default 50; the maximum, 200, stands inLimits.bounds, and a larger value is lowered with the noticepage_size_lowered.
-
page_token:
typing.Optional[str]— The next page of changes, as the last answer'snext_page_tokengave it; bound to this comparison and the body's other fields,page_sizeincluded. Default none, the first page.
-
request_options:
typing.Optional[RequestOptions]— Request-specific configuration.
-
-
client.get_limits() -> Limits
-
-
-
Read your key's limits and your account's money in one answer, free, before a batch or any call that must fit a budget. You get the prepaid balance after the sums reserved by calls in flight, the use of the current period, every unit's price, the key's cap on one call and its budgets, its rate and the calls allowed in flight at once, the published bounds of both families, the document types taken, the countries getclean can read from, the recognition languages, the archives, the key's policy, and the versions served with the current one. There is no estimate operation:
max_costis the protection, andpricesgives every unit's price.What it costs. The key needs
limits:read. The call is free. The answer is200withLimits, never cached, since it is the key's own.Refused before any work. An unknown query parameter:
400 invalid-request,unknown_field.Problem types.
- 400
invalid-request, The request is invalid. - 401
unauthorized, The key is missing or rejected. - 403
insufficient-scope, The key lacks a scope this call needs. - 429
rate-limit-exceeded, The rate limit is exceeded;concurrency-limit-exceeded, Too many calls are in flight. - 500
internal-error, The service failed. - 503
overloaded, The service is overloaded.
- 400
-
-
-
from getclean import GetClean from getclean.environment import GetCleanEnvironment client = GetClean( environment=GetCleanEnvironment.PRODUCTION, ) client.get_limits()
-
-
-
request_options:
typing.Optional[RequestOptions]— Request-specific configuration.
-
-
client.search(...) -> Search
-
-
-
Search up to ten datasources with one question, in up to twenty wordings, and get one ranked list of results with the facts of each and a receipt of what ran where, before any page is read. Each result is a lead, the one page shown for a group of copies. The search is kept as a record, so its full list is read again free, and every cut, skip or change is named in the answer. Use
contentsto fetch the top leads in the same call,fetch_contentsto read one by its URL, andlist_datasourcesto see what can be searched.What it costs. The key needs
search:run, which covers everything a search does, the inline fetches and their model fields included, under the key's policy. The price is 1searches, plus 1datasource_queriesper source per wording that ran, plus 1model_stepsfor the ranking and 1 for the choice of sources when they ran, plus the inline fetches priced asfetch_contents; a ranking cut by the deadline is not billed. The answer is201 CreatedwithLocationnaming the record,Search. The record is kept 48 hours after its last call and at most 30 days from its making;get_searchpages the list the search stored and never searches again or charges. A search answers withinwait_seconds; what did not finish is named in apartialoutcome. There is no job, no stream and no webhook.The idempotency key.
Idempotency-Keyis optional here. The same key with the same body returns the first answer again with this call'srequest_id, the currentexpires_atandreplayedtrue on everycost, no second charge; the same key in flight is409 idempotency-key-in-flight; the same key with another body422 idempotency-key-reused.The default call,
{"query": "…"}: the web plus the groups a model picks; ten results from each source per wording; ranked by a model; ten leads with 600-character excerpts and their publisher profiles; moderate safe search; ten seconds; the full record; the key's default run. Two model steps run by default, the ranking and the choice of sources when none are named, and a third identifies the publisher of a site getclean has not seen before;deterministic_onlyturns all three off.Languages. A wording runs only on a source that covers its language. The web source takes every wording, each in its own language, searched from
subject_country; a source in one language takes only wordings in that language; a source with one index per language takes each wording in its own index. A wording no source covers is a coverage gap, with the hint to add a wording in the source's language.languagesrestricts the pages returned and is independent of this. Nothing is translated. Withsubject_identifiersand noquery, each identifier's value runs as a wording with originidentifier.The inline fetch.
contents.topof the leads are fetched in the same call, each as a contents record underfetch_contents's rules.- It takes the search's
as_of_date,pinned_version,run_id,deterministic_only,retentionandmax_source_price, and itssubject_countrywhen that is a country getclean can read from, else the key'sdefault_exitwith the noticefield_not_applicable. - A lead found through a registered datasource is fetched under that datasource's login, the one way to use a login on a fetch.
- Its time comes out of the search's
wait_seconds, and it runs under what remains of the search's ceiling at its turn. Each inline record carries its owncost. - At the deadline the record follows the contents' rules. A fetch not started by the deadline makes no record, and the search ends
partial,fetches_missing, with the noticefetch_not_finished. contents.max_charactersbounds one page.max_total_charactersbounds the whole answer's text, excerpts and fetched pages together: the excerpts first, cut from the last lead backwards when they alone pass it, then the fetched pages in rank order while they fit in what remains; a page that would pass it comes assections_only; each cut makes the noticetotal_characters_cut.
Money. The ceiling is the lowest of the request's
max_cost, the key's cap, the run's budget, the key's budget and the balance. When it cannot cover everything, the extras are cut in this order, each with the noticecost_cut: first each inline fetch's own extras, in the orderfetch_contentsgives; then whole fetches, the search endingpartial,fetches_missing; then the ranking,partial,rerank_missing; then the choice of sources; then the results taken per source.max_source_priceis the most you allow for a datasource that charges per query, or for a site an inline fetch meets that asks a price; a source whose fee passes it is not searched, the coverage gapover_price. getclean pays no site for a page, so a page that asks a price endspayment_required.Said, never refused. A hard filter a source cannot apply and cannot emulate: that source skipped, in
coverage_gaps, the filter named. A wording in a language no source covers:coverage_gaps.source_independence, orindependentinranking_priorities, with no subject resolved: noticefield_not_applicable. A window later thanas_of_date, or a per-site cap on one allowed site: a notice.datasourcesabsent underdeterministic_only: the receipt showswebonly. The inline fetch'ssubject_countrynot inLimits.exits: noticefield_not_applicable, the key'sdefault_exitused.max_source_pricebelow a datasource's fee: that source skipped, coverage gapover_price. Anissuersent with a scheme that takes none: noticefield_not_applicable, the identifier runs by itsschemeandvalue.Fields that read alike.
allowed_domainsnames sites that count, names with dots;datasourcesnames places to search, names without.allowed_domainsis hard, only these;ranking_preferred_domainsis soft, these first and the rest still count.subject_countryis where the search is made from;languagesis what the pages are written in.published_fromis the page's own date;as_of_datethe source's state on a past day.pinned_versionis getclean's version;as_of_datethe sources' day.purposeis why, for the record and every model step;ranking_instructionsis how to rank.ranking_prioritiessays which source facts go first;ranking_orderhow the rest is ordered.source_kindsis a filter that removes;ranking_priorities: officiala preference that reorders.max_per_datasourceis taken from each source before merging;ranking_max_per_domainis kept from each site in the answer.max_candidatesis how many leads;contents.tophow many of them to fetch.max_excerpt_charactersis per lead,max_total_charactersthe whole answer,contents.max_charactersone page fetched. Leaving the model fields out still runs the ranking and the choice of sources;deterministic_onlyturns every judging step off.viewis how much of the record comes back;record_formthe form the record is written in.Refused before any work, every violation of the body reported at once in
violations:- Neither
querynorsubject_identifiers:invalid-field,required. alternate_querieswithoutquery:dependent.- A scheme that needs an issuer, without one:
dependent; anissuerno catalog entry lists for its scheme:not_allowed, with the listed codes inallowed_values. published_within_dayswithpublished_fromorpublished_until:exclusive;published_untilbeforepublished_from:order; a date after today:bound.- A site in both
allowed_domainsandblocked_domains:exclusive; aranking_preferred_domainsvalue outsideallowed_domainswhen that is set, or inblocked_domains:dependent. - A site name in
datasources, or a datasource id inallowed_domains,blocked_domainsorranking_preferred_domains:misplaced,change.fieldnaming the field it belongs in. contentswithouttop:required;topabove 10:bound;topabovemax_candidates:order;contentswithwait_secondsbelow 5, the least a fetch needs:order.- Under
deterministic_only:ranking_instructions, andjson_schemaorsummaryinsidecontents:model-work-refused. - More than 20 wordings after OR splits:
bound, with the count. max_costbelow the smallest call's price, onesearchesand onedatasource_queries:cost-exceeds-cap, withminimum_cap.max_total_charactersbelowmax_excerpt_characters:order.- A source getclean cannot search:
datasource-not-searchable. Every named source behind a login the key has not registered:403 datasource-access-required; one such source among others is the coverage gapaccess_needed, and the rest run. safe_searchordeterministic_onlylooser than the key's policy, orallowed_domainswidening the key's domain policy:403 policy-limit-exceeded.- A value of
source_kinds,source_independence,ranking_prioritiesorranking_orderoutside its set:not_allowed. - Every source would be skipped before work:
no-datasource-can-run. - An unknown datasource id:
datasource-unknown; an unknownset:NAME:domain-set-unknown. - A bare
pdfinmedia_types:not_allowed, withapplication/pdfsuggested. - Any other bound passed:
bound; an unknown field:unknown_field. pinned_versionnot served, never or no longer:version-withdrawn.
Notices this operation makes.
query_corrected,filter_emulated,default_set_by_policy,window_after_as_of_date,fetch_not_finished,cost_cut,budget_cut,time_cut,field_not_applicable,total_characters_cuton the search and on an inline record,version_retiring. A skipped source is a coverage gap, never a notice too.Problem types. A source's failure is never an API problem; it stands as that source's outcome in the receipt.
- 400
invalid-request, The request is invalid. - 401
unauthorized, The key is missing or rejected. - 403
insufficient-scope, The key lacks a scope this call needs;policy-limit-exceeded, The key's policy forbids this;datasource-access-required, The datasource needs a registered login;credit-exhausted, The credit is exhausted;run-budget-exhausted, The run's budget is exhausted;key-budget-exhausted, The key's budget is exhausted. - 409
idempotency-key-in-flight, The same request is still running. - 413
body-too-large, The body is too large. - 415
unsupported-media-type, The media type is not supported. - 422
invalid-field, A field is invalid;model-work-refused, Model work is refused by the request;cost-exceeds-cap, The cost cap is below the smallest call;version-withdrawn, The version is no longer served;idempotency-key-reused, The idempotency key was reused with another body;no-datasource-can-run, No datasource can run this search;datasource-unknown, The datasource is unknown;datasource-not-searchable, The datasource has no search;domain-set-unknown, The domain set is unknown. - 429
rate-limit-exceeded, The rate limit is exceeded;concurrency-limit-exceeded, Too many calls are in flight. - 451
legal-block, Withheld under a legal demand. - 500
internal-error, The service failed. - 503
overloaded, The service is overloaded.
- It takes the search's
-
-
-
from getclean import GetClean, SearchContentsOptions, Money from getclean.environment import GetCleanEnvironment client = GetClean( environment=GetCleanEnvironment.PRODUCTION, ) client.search( query="EU AI Act article 50 marking obligations", published_within_days=365, max_candidates=3, contents=SearchContentsOptions( top=1, max_characters=8000, ), max_cost=Money( amount="0.1000", currency="USD", ), )
-
-
-
idempotency_key:
typing.Optional[str]One key per logical call, so a retry is never billed twice.
Optional on this operation; required on
upload_contents,fetch_contents_batchandsearch_batch, where a duplicate would cost the most. The SDKs fill a fresh key when you give none and send the same key on every retry of that call. Give your own key when your program retries across processes, so the second run finds the first answer.The form: 1 to 255 visible ASCII characters, used exactly as sent, so a value written as a quoted Structured Field String keeps its quotes as part of the key. That is a stated departure from the IETF draft
draft-ietf-httpapi-idempotency-key-header, revision 08, which is not yet a standard; this parameter documents the form in full.What a repeated key does:
- The same key with the same body returns the first answer again, with this call's
request_id,expires_atas it stands andreplayedtrue on everycost. Nothing is billed again. - The same key while the first call still runs:
409 idempotency-key-in-flight, withRetry-After. - The same key with another body:
422 idempotency-key-reused.
Answers are stored for 24 hours, per account, for billed answers and running jobs only; a free answer is not stored. A call that may bill is kept in the store from its start, so a second call with its key meets the
409while it runs. - The same key with the same body returns the first answer again, with this call's
-
query:
typing.Optional[str]— The question, 1 to 2,000 characters; required unlesssubject_identifiersis sent."phrase",-word,OR, one level of( ),site:,filetype:,intitle:,inurl:,before:,after:and*are honored where a source supports them, and the receipt'soperators_appliedsays what each source did with each.
-
alternate_queries:
typing.Optional[typing.Sequence[str]]— Other wordings of the question, in any language, each 1 to 2,000 characters, up to 10; one merged list withquery, 20 wordings at most after OR splits. Default none. A wording runs only on the sources that cover its language; nothing is translated, so a wording in another language reaches the sources in that language. Withoutqueryit is refuseddependent.
-
subject_identifiers:
typing.Optional[typing.Sequence[SubjectIdentifier]]— Exact codes of the subject, up to 10SubjectIdentifierobjects; with noquery, each identifier's value runs as a wording with originidentifier.issueris required forticker,docket,tax_idandregistry, as the catalog's codes; a duplicate is refusedduplicate. Default none.
-
subject_country:
typing.Optional[str]— The country the search is made from, ISO 3166-1 alpha-2; groups of sources expand by it; the inline fetch reads from it when it is a country getclean can read from, one ofLimits.exits, else from the key'sdefault_exitwith the noticefield_not_applicable. Default none.
-
purpose:
typing.Optional[str]— Your reason for the search, kept in the record and read by every model step; never sent to a source. At most 2,000 characters. Default none.
-
datasources:
typing.Optional[typing.Sequence[str]]— Where to search: up to 10 of a datasource id, a group, orset:NAME, a published set, each 1 to 64 characters; these are names without dots, whereallowed_domainstakes site names with dots. When sent, the search runs on these plus the sources that resolve a scheme of yoursubject_identifiers, added without a model step, each in the receipt with reasonidentifier. When absent, it runs onwebplus the groups a model chooses for the question, one model step, each named; underdeterministic_only, onwebonly. An unknown id isdatasource-unknown, an unknown setdomain-set-unknown, a site name heremisplaced.
-
allowed_domains:
typing.Optional[typing.Sequence[str]]— Only results on these sites count, site names with dots: up to 500 of a domain, a wildcard such as*.example.com, a URL prefix, a suffix such as.gov, orset:NAME, a published set, each 1 to 2,048 characters. What each form reaches: a domain, that host and every host under it;*.example.com, the hosts under the domain and not the domain itself; a URL prefix, every address that begins with it; a suffix with a leading dot, every domain that ends in it;set:NAME, the sites of that set. It may narrow the key'spolicy.allowed_domainsand never widen it, which ispolicy-limit-exceeded. Default none. A site in both this andblocked_domainsis refusedexclusive; a datasource id heremisplaced.
-
blocked_domains:
typing.Optional[typing.Sequence[str]]— Never results on these sites; up to 500 of the same forms and bound asallowed_domains, each form reaching what it reaches there. Default none.
-
published_from:
typing.Optional[datetime.date]— Pages published on or after this date, inclusive, by the page's own date. Default none. Withpublished_within_daysit is refusedexclusive; afterpublished_untilthe pair is refusedorder; a date after todaybound; a window that begins afteras_of_datemakes the noticewindow_after_as_of_date.
-
published_until:
typing.Optional[datetime.date]— Pages published on or before this date, inclusive. Default none.
-
published_within_days:
typing.Optional[int]— Pages published within this many days counted back from today, or fromas_of_datewhen it is sent; 1 to 3,650. Not withpublished_fromorpublished_until, which is refusedexclusive. Default none.
-
undated:
typing.Optional[Undated]— Whether pages with no detectable date are kept inside a date window:shownkeeps them,hiddendrops them. Defaultshown. Sent without a window it makes the noticefield_not_applicable.
-
languages:
typing.Optional[typing.Sequence[str]]— Only pages written in these languages, up to 10 BCP 47 tags, each 1 to 35 characters; what the pages are written in, independent of the wordings' languages. Default none.
-
media_types:
typing.Optional[typing.Sequence[str]]— Only these file types, up to 10 IANA media types, each 1 to 255 characters; a barepdfis refusednot_allowedwithapplication/pdfsuggested. Default none.
-
safe_search:
typing.Optional[SafeSearch]— How strictly adult content is filtered:off,moderateorstrict. Where a source has the setting it is mapped to the nearest level, said with the noticefilter_emulated; it never removes a source. Never looser than the key'spolicy.safe_search, which ispolicy-limit-exceeded. Defaultmoderate.
-
source_kinds:
typing.Optional[typing.Sequence[str]]— Only these kinds of publisher, 1 to 24 ofstate,court,regulator,statistics_office,intergovernmental,standards_body,academic,scholarly_publisher,archive,reference,press,information_provider,company,professional_practice,trade_body,marketplace,civil_society,political,religious,education,healthcare,cultural,individual,community, neverunknown; a filter that removes, whereranking_prioritiesonly reorders. Default none.
-
source_independence:
typing.Optional[SourceIndependence]— Only sources independent of the subject, or only its own;independentorself. Needs a subject resolved fromsubject_identifiers, else the noticefield_not_applicable. Default none, any.
-
as_of_date:
typing.Optional[datetime.date]— Search each source as it stood at the end of that day, UTC, and read any inline fetch from an archive's copy of that day. A date not after today. Default none, the sources as they stand now. A source that keeps no history reportsno_history.
-
max_per_datasource:
typing.Optional[int]— Results taken from each source per wording, before merging; capped by the source's maximum. 1 to 100; default 10.
-
ranking_instructions:
typing.Optional[str]— Your instructions to the ranking model, at most 2,000 characters; kept in the record. Default none. Refusedmodel-work-refusedunderdeterministic_only.
-
ranking_priorities:
typing.Optional[typing.Sequence[RankingPriority]]— Source facts that go first, in this order, up to 4 ofofficial,independent,primary,reviewed; the leads grouped by them, then ordered within each group byranking_order. Default none.independentwith no subject resolved makes the noticefield_not_applicable.
-
ranking_order:
typing.Optional[RankingOrder]— The order within each priority group;relevance,newestoroldest; undated pages last under the date orders; the relevance cut-off applies in every case. Defaultrelevance.
-
ranking_preferred_domains:
typing.Optional[typing.Sequence[str]]— Sites ranked first among results of equal relevance; other sites still count. Up to 500 of the forms ofallowed_domains, each reaching what it reaches there, each 1 to 2,048 characters. Default none. A value outsideallowed_domainswhen it is set, or inblocked_domains, is refuseddependent.
-
ranking_max_per_domain:
typing.Optional[int]— The most leads kept from one site in the answer, 1 to 50. Default none. With one allowed site it makes the noticefield_not_applicable.
-
max_candidates:
typing.Optional[int]— The leads returned, 1 to 50; default 10. The results past them are read free byget_search.
-
max_excerpt_characters:
typing.Optional[int]— The excerpt per lead, in characters, 0 to 4,000; 0 means none. Default 600.
-
max_total_characters:
typing.Optional[int]— The whole answer's text, excerpts and fetched pages together, 1,000 to 200,000; the excerpts first, cut from the last lead backwards when they alone pass it, then the fetched pages in rank order while they fit in what remains, a page that would pass it coming assections_only; each cut the noticetotal_characters_cut. Default 40,000. Belowmax_excerpt_charactersit is refusedorder.
-
contents:
typing.Optional[SearchContentsOptions]— Fetch this many top leads in the same call, under the inline fetch's rules;contents.max_charactersbounds one page,max_total_charactersthe whole answer. Default none. The options withouttopare refusedrequired;topabovemax_candidatesorder; withwait_secondsbelow 5, the least a fetch needs,order.
-
view:
typing.Optional[View]— How much of the record comes back:full, every member, orcompact, the smaller form theSearchschema lists. Defaultfull.
-
wait_seconds:
typing.Optional[float]— The most seconds this call may work, the ranking, the choice of sources and every inline fetch inside, counted from the start of the work; what did not finish comes backpartial, named. 0.2 to 60; default 10.
-
max_cost:
typing.Optional[Money]— The most this call may cost, in the account's currency. When it cannot cover everything, the extras are cut in order, each with the noticecost_cut: first each inline fetch's own extras, then whole fetches, then the ranking, then the choice of sources, then the results taken per source. Default the key's cap on one call. Below the smallest call's price, onesearchesand onedatasource_queries, it is refusedcost-exceeds-capwithminimum_cap.
-
deterministic_only:
typing.Optional[bool]— Turn off every step a model judges: the ranking and the choice of sources, which the answer then says; the publisher's kind only from what getclean already knows; the inline fetch'sjson_schemaandsummaryrefused by name and itshighlightsfound verbatim only. Text recognition on a scanned page fetched inline still runs and is listed. Default false. Sending false under a key whose policy forbids model work ispolicy-limit-exceeded.
-
pinned_version:
typing.Optional[str]— The version of getclean to run under, at most 64 characters. Default the current version. A version not served isversion-withdrawn.
-
run_id:
typing.Optional[str]— The run the record belongs to, an existing run of the key. Default the key's default run. An unknown run is refusednot_allowed.
-
record_form:
typing.Optional[str]— Have the search written up for a reviewer:plain, in plain words, orprisma, in the PRISMA form a systematic review reports; an open set. Default none, no write-up.
-
metadata:
typing.Optional[typing.Dict[str, str]]— Your own labels, returned on the record as sent and never passed to a source: at most 20 string pairs, keys of 1 to 64 characters, values of 1 to 512. Default none. An empty map is refusedbound.
-
max_source_price:
typing.Optional[Money]— The most you allow for a datasource that charges per query, or for a site an inline fetch meets that asks a price. A source whose fee passes it is not searched, the coverage gapover_price, never a refusal. getclean pays no site for a page, so a page that asks a price endspayment_required. Default none.
-
retention:
typing.Optional[Retention]— How long the search record and every inline record are kept:hold, 48 hours after the last call and at most 30 days, allowed only under aholdpolicy;none, nothing kept past the answer. Default the key'spolicy.retention.
-
request_options:
typing.Optional[RequestOptions]— Request-specific configuration.
-
-
client.get_search(...) -> SyncPager[Candidate, Search]
-
-
-
Read a search you already have, free: the first page as it was answered, and behind it the full list the search stored, including the results it dropped and why. Nothing is searched again and nothing is charged; only the record's
expires_atmoves.The first page is the original answer as stored, whatever
page_size: its members and the notices kept with it. A notice of the original answer that was not kept does not come back, anddropped_reasonis absent on every candidate. A later page is the stored list in rank order, and every item on it carriesdropped_reason. Every other member comes as stored;request_idis this call's, andexpires_atis the record's new one.next_page_tokencomes while more remain.fetch_contentsreads a candidate by its URL.What it costs. The key needs
search:read. The call is free. The answer is200withSearch; the call moves the record'sexpires_at48 hours ahead.Refused before any work. A value outside its set or range,
page_sizeabove its maximum excepted, which is lowered with the noticepage_size_lowered:400 invalid-request,not_allowedorbound, each with where it is. An id of the wrong kind:400 invalid-request, before any lookup. A token of another search or another query:400 page-token-invalid. An unknown query parameter:400 invalid-request,unknown_field.Notices this operation makes. The search's own notices first, then
page_size_loweredandversion_retiring.Problem types.
- 400
invalid-request, The request is invalid;page-token-invalid, The page token is invalid. - 401
unauthorized, The key is missing or rejected. - 403
insufficient-scope, The key lacks a scope this call needs. - 404
not-found, Not found: an unknown or another account's search. - 410
search-expired, The search has expired: for 30 days after it expired, to the owning account only, withexpired_atandchangenamingsearch; then404. - 429
rate-limit-exceeded, The rate limit is exceeded;concurrency-limit-exceeded, Too many calls are in flight. - 500
internal-error, The service failed. - 503
overloaded, The service is overloaded.
- 400
-
-
-
from getclean import GetClean from getclean.environment import GetCleanEnvironment client = GetClean( environment=GetCleanEnvironment.PRODUCTION, ) client.get_search( search_id="srch_4HmUunqCCXquleKVCosqFG", page_token="eyJzIjoic3JjaF80SG0iLCJvIjoyfQ", )
-
-
-
search_id:
str— The search record, ansrch_id assearchreturned it.
-
view:
typing.Optional[View]— How much of the record comes back:full, every member, orcompact, the smaller form theSearchschema lists. Defaultfull.
-
page_size:
typing.Optional[int]— Results per page of the stored list, from 1; the maximum, 50, stands inLimits.bounds, and a larger value is lowered with the noticepage_size_lowered. Default the search'smax_candidates.
-
page_token:
typing.Optional[str]— The next page of the stored list, as the last answer'snext_page_tokengave it; opaque, at most 1,024 characters, alive as long as the record. Default none, the first page.
-
request_options:
typing.Optional[RequestOptions]— Request-specific configuration.
-
-
client.search_batch(...) -> SearchBatch
-
-
-
Run 1 to 20 searches in one call, one record each. You get the tally first, then one result per item in input order, each a search record or the problem that skipped it; nothing is atomic, so a skipped item leaves the others standing. Each item carries its own question, wordings, identifiers, country and purpose; every other field of
searchstands once at the top and is shared by every item.What it costs. The key needs
search:run. The price is the sum of the searches' costs,unitssummed by name. The answer is200withSearchBatch. The body is at most 4 MiB.The idempotency key.
Idempotency-Keyis required here, since a repeated batch would run and bill every search twice; its absence is400 invalid-requestnaming the header. A replay repeats the whole answer with this call'srequest_id, the currentexpires_atof every record andreplayedtrue on everycost; the same key in flight is409 idempotency-key-in-flight; the same key with another body422 idempotency-key-reused.Faults and limits.
- A datasource behind an unregistered login, a policy the item's sites break, a legal demand, or the remainder of the ceiling: that item comes back
skippedwith its problem, withoutstatus, and the batch still runs. A fault of a shared top field skips every item. A fault of the batch's shape or of any field's rule refuses the whole call. wait_secondsis each item's own deadline from its own start. The call's whole time is bounded bybounds.search.batch_seconds, and an item not started when it ends isskippedwith the problemoverloaded,retry_after_secondsset.max_cost: the whole call is refused below one search's smallest price, with the problem of the limit that binds; else it is reserved at the start and split in input order, each item its smallest call and the model steps asked by name. The items the remainder cannot cover areskippedwith the problem of the limit that binds:cost-exceeds-capfor the request'smax_cost,policy-limit-exceededfor the key's cap,credit-exhausted,run-budget-exhaustedorkey-budget-exhausted.- An item's
Searchcarries the batch call'srequest_id, itsapplied_requestthe item's fields merged with the top's, the top'smetadata, and its ownexpires_at.
Refused before any work, every violation of the body reported at once in
violations:- Fewer than 1 or more than 20 items:
invalid-field,bound. - An item with neither
querynorsubject_identifiers:required. - A
labelrepeated:duplicate; alabeloutside its character set or length:syntax,bound. - A top-only field inside an item, or an item field at the top:
misplaced. - Every rule of
searchon the top fields and on an item's own fields refuses the whole call, except a named source behind a login the key has not registered, a site the key's policy forbids and a legal block, which skip the items they touch. - An unknown field, at the top or in an item:
unknown_field. Idempotency-Keyabsent:400 invalid-request.
Notices this operation makes. Every notice of
searchinside each item's record,version_retiringinside each too.Problem types. For the whole call:
- 400
invalid-request, The request is invalid. - 401
unauthorized, The key is missing or rejected. - 403
insufficient-scope, The key lacks a scope this call needs;policy-limit-exceeded, The key's policy forbids this, for a setting, a minimum or a widening of the key's domain policy;credit-exhausted, The credit is exhausted;run-budget-exhausted, The run's budget is exhausted;key-budget-exhausted, The key's budget is exhausted. - 409
idempotency-key-in-flight, The same request is still running. - 413
body-too-large, The body is too large. - 415
unsupported-media-type, The media type is not supported. - 422
invalid-field, A field is invalid;model-work-refused, Model work is refused by the request;cost-exceeds-cap, The cost cap is below the smallest call;version-withdrawn, The version is no longer served;idempotency-key-reused, The idempotency key was reused with another body;no-datasource-can-run, No datasource can run this search;datasource-unknown, The datasource is unknown;datasource-not-searchable, The datasource has no search;domain-set-unknown, The domain set is unknown. - 429
rate-limit-exceeded, The rate limit is exceeded;concurrency-limit-exceeded, Too many calls are in flight. - 500
internal-error, The service failed. - 503
overloaded, The service is overloaded.
Inside a skipped item, each without
status:datasource-access-required,policy-limit-exceeded,legal-block,cost-exceeds-cap,credit-exhausted,run-budget-exhausted,key-budget-exhausted,overloaded. - A datasource behind an unregistered login, a policy the item's sites break, a legal demand, or the remainder of the ceiling: that item comes back
-
-
-
from getclean import GetClean, SearchBatchItem, Money from getclean.environment import GetCleanEnvironment client = GetClean( environment=GetCleanEnvironment.PRODUCTION, ) client.search_batch( items=[ SearchBatchItem( label="a", query="EU AI Act article 50 marking obligations", ), SearchBatchItem( label="b", query="EU AI Act article 52 transparency", ) ], max_candidates=3, max_cost=Money( amount="0.0150", currency="USD", ), )
-
-
-
items:
typing.Sequence[SearchBatchItem]— The searches, 1 to 20SearchBatchItemobjects in the order the results come back; the same question may repeat and makes two records. Required.
-
idempotency_key:
typing.Optional[str]One key per logical call, so a retry is never billed twice.
Required on this operation, where a duplicate would cost the most; without it the call is
400 invalid-requestnaming the header. The SDKs fill a fresh key when you give none and send the same key on every retry of that call. Give your own key when your program retries across processes, so the second run finds the first answer.The form: 1 to 255 visible ASCII characters, used exactly as sent, so a value written as a quoted Structured Field String keeps its quotes as part of the key. That is a stated departure from the IETF draft
draft-ietf-httpapi-idempotency-key-header, revision 08, which is not yet a standard; this parameter documents the form in full.What a repeated key does:
- The same key with the same body returns the first answer again, with this call's
request_id, the currentexpires_atandreplayedtrue on everycost. Nothing is billed again. On the upload the body is compared by a digest over the document and the fields, and a retried start with the same key is the same job. - The same key while the first call still runs:
409 idempotency-key-in-flight, withRetry-After. - The same key with another body:
422 idempotency-key-reused.
Answers are stored for 24 hours, per account, for billed answers and running jobs only. A call that may bill is kept in the store from its start, so a second call with its key meets the
409while it runs. - The same key with the same body returns the first answer again, with this call's
-
datasources:
typing.Optional[typing.Sequence[str]]— Where to search: up to 10 of a datasource id, a group, orset:NAME, a published set, each 1 to 64 characters; these are names without dots, whereallowed_domainstakes site names with dots. When sent, the search runs on these plus the sources that resolve a scheme of yoursubject_identifiers, added without a model step, each in the receipt with reasonidentifier. When absent, it runs onwebplus the groups a model chooses for the question, one model step, each named; underdeterministic_only, onwebonly. An unknown id isdatasource-unknown, an unknown setdomain-set-unknown, a site name heremisplaced.
-
allowed_domains:
typing.Optional[typing.Sequence[str]]— Only results on these sites count, site names with dots: up to 500 of a domain, a wildcard such as*.example.com, a URL prefix, a suffix such as.gov, orset:NAME, a published set, each 1 to 2,048 characters. What each form reaches: a domain, that host and every host under it;*.example.com, the hosts under the domain and not the domain itself; a URL prefix, every address that begins with it; a suffix with a leading dot, every domain that ends in it;set:NAME, the sites of that set. It may narrow the key'spolicy.allowed_domainsand never widen it, which ispolicy-limit-exceeded. Default none. A site in both this andblocked_domainsis refusedexclusive; a datasource id heremisplaced.
-
blocked_domains:
typing.Optional[typing.Sequence[str]]— Never results on these sites; up to 500 of the same forms and bound asallowed_domains, each form reaching what it reaches there. Default none.
-
published_from:
typing.Optional[datetime.date]— Pages published on or after this date, inclusive, by the page's own date. Default none. Withpublished_within_daysit is refusedexclusive; afterpublished_untilthe pair is refusedorder; a date after todaybound; a window that begins afteras_of_datemakes the noticewindow_after_as_of_date.
-
published_until:
typing.Optional[datetime.date]— Pages published on or before this date, inclusive. Default none.
-
published_within_days:
typing.Optional[int]— Pages published within this many days counted back from today, or fromas_of_datewhen it is sent; 1 to 3,650. Not withpublished_fromorpublished_until, which is refusedexclusive. Default none.
-
undated:
typing.Optional[Undated]— Whether pages with no detectable date are kept inside a date window:shownkeeps them,hiddendrops them. Defaultshown. Sent without a window it makes the noticefield_not_applicable.
-
languages:
typing.Optional[typing.Sequence[str]]— Only pages written in these languages, up to 10 BCP 47 tags, each 1 to 35 characters; what the pages are written in, independent of the wordings' languages. Default none.
-
media_types:
typing.Optional[typing.Sequence[str]]— Only these file types, up to 10 IANA media types, each 1 to 255 characters; a barepdfis refusednot_allowedwithapplication/pdfsuggested. Default none.
-
safe_search:
typing.Optional[SafeSearch]— How strictly adult content is filtered:off,moderateorstrict. Where a source has the setting it is mapped to the nearest level, said with the noticefilter_emulated; it never removes a source. Never looser than the key'spolicy.safe_search, which ispolicy-limit-exceeded. Defaultmoderate.
-
source_kinds:
typing.Optional[typing.Sequence[str]]— Only these kinds of publisher, 1 to 24 ofstate,court,regulator,statistics_office,intergovernmental,standards_body,academic,scholarly_publisher,archive,reference,press,information_provider,company,professional_practice,trade_body,marketplace,civil_society,political,religious,education,healthcare,cultural,individual,community, neverunknown; a filter that removes, whereranking_prioritiesonly reorders. Default none.
-
source_independence:
typing.Optional[SourceIndependence]— Only sources independent of the subject, or only its own;independentorself. Needs a subject resolved from an item'ssubject_identifiers, else the noticefield_not_applicable. Default none, any.
-
as_of_date:
typing.Optional[datetime.date]— Search each source as it stood at the end of that day, UTC, and read any inline fetch from an archive's copy of that day. A date not after today. Default none, the sources as they stand now. A source that keeps no history reportsno_history.
-
max_per_datasource:
typing.Optional[int]— Results taken from each source per wording, before merging; capped by the source's maximum. 1 to 100; default 10.
-
ranking_instructions:
typing.Optional[str]— Your instructions to the ranking model, at most 2,000 characters; kept in the record. Default none. Refusedmodel-work-refusedunderdeterministic_only.
-
ranking_priorities:
typing.Optional[typing.Sequence[RankingPriority]]— Source facts that go first, in this order, up to 4 ofofficial,independent,primary,reviewed; the leads grouped by them, then ordered within each group byranking_order. Default none.independentwith no subject resolved makes the noticefield_not_applicable.
-
ranking_order:
typing.Optional[RankingOrder]— The order within each priority group;relevance,newestoroldest; undated pages last under the date orders; the relevance cut-off applies in every case. Defaultrelevance.
-
ranking_preferred_domains:
typing.Optional[typing.Sequence[str]]— Sites ranked first among results of equal relevance; other sites still count. Up to 500 of the forms ofallowed_domains, each reaching what it reaches there, each 1 to 2,048 characters. Default none. A value outsideallowed_domainswhen it is set, or inblocked_domains, is refuseddependent.
-
ranking_max_per_domain:
typing.Optional[int]— The most leads kept from one site in the answer, 1 to 50. Default none. With one allowed site it makes the noticefield_not_applicable.
-
max_candidates:
typing.Optional[int]— The leads returned per search, 1 to 50; default 10. The results past them are read free byget_search.
-
max_excerpt_characters:
typing.Optional[int]— The excerpt per lead, in characters, 0 to 4,000; 0 means none. Default 600.
-
max_total_characters:
typing.Optional[int]— Each search's whole text, excerpts and fetched pages together, 1,000 to 200,000; the excerpts first, cut from the last lead backwards when they alone pass it, then the fetched pages in rank order while they fit in what remains, a page that would pass it coming assections_only; each cut the noticetotal_characters_cut. Default 40,000. Belowmax_excerpt_charactersit is refusedorder.
-
contents:
typing.Optional[SearchContentsOptions]— Fetch this many top leads of each search in the same call, under the inline fetch's rules;contents.max_charactersbounds one page,max_total_charactersthe whole answer. Default none. The options withouttopare refusedrequired;topabovemax_candidatesorder; withwait_secondsbelow 5, the least a fetch needs,order.
-
view:
typing.Optional[View]— How much of each record comes back:full, every member, orcompact, the smaller form theSearchschema lists. Defaultfull.
-
wait_seconds:
typing.Optional[float]— The most seconds each search may work, counted from its own start, the ranking, the choice of sources and every inline fetch inside; the call's whole time is bounded bybounds.search.batch_seconds. 0.2 to 60; default 10.
-
max_cost:
typing.Optional[Money]— The most the whole call may cost, in the account's currency; reserved at the start and split in input order, each item its smallest call and the model steps asked by name, the items the remainder cannot cover skipped. Default the key's cap on one call. Below one search's smallest price, onesearchesand onedatasource_queries, it is refused with the problem of the limit that binds,cost-exceeds-capwithminimum_capfor the request's own.
-
deterministic_only:
typing.Optional[bool]— Turn off, for every search, every step a model judges: the ranking and the choice of sources, which the answer then says; the publisher's kind only from what getclean already knows; the inline fetch'sjson_schemaandsummaryrefused by name and itshighlightsfound verbatim only. Default false. Sending false under a key whose policy forbids model work ispolicy-limit-exceeded.
-
pinned_version:
typing.Optional[str]— The version of getclean to run under, at most 64 characters. Default the current version. A version not served isversion-withdrawn.
-
run_id:
typing.Optional[str]— The run every record belongs to, an existing run of the key. Default the key's default run. An unknown run is refusednot_allowed.
-
record_form:
typing.Optional[str]— Have each search written up for a reviewer:plain, in plain words, orprisma, in the PRISMA form a systematic review reports; an open set. Default none, no write-up.
-
metadata:
typing.Optional[typing.Dict[str, str]]— Your own labels, returned on every search record as sent and never passed to a source: at most 20 string pairs, keys of 1 to 64 characters, values of 1 to 512. Default none. An empty map is refusedbound.
-
max_source_price:
typing.Optional[Money]— The most you allow for a datasource that charges per query, or for a site an inline fetch meets that asks a price. A source whose fee passes it is not searched, the coverage gapover_price, never a refusal. getclean pays no site for a page, so a page that asks a price endspayment_required. Default none.
-
retention:
typing.Optional[Retention]— How long every search record and inline record of the batch is kept:hold, 48 hours after the last call and at most 30 days, allowed only under aholdpolicy;none, nothing kept past the answer. Default the key'spolicy.retention.
-
request_options:
typing.Optional[RequestOptions]— Request-specific configuration.
-
-
client.list_datasources(...) -> SyncPager[Datasource, DatasourcePage]
-
-
-
List the places getclean can search, free; the answer may be cached for an hour. An entry's
id, itsgrouporset:NAMEgoes into the search'sdatasources;filtersandoperatorssay what each source honors, before any search;issuersgives the codes an identifier scheme takes, so your agent learns a code from the catalog and never guesses one. Every filter you send must match, and the order is the catalog's own.What it costs. The key needs
search:read. The call is free. The answer is200withDatasourcePageandCache-Control: max-age=3600, so a cached answer repeats the first call'srequest_idand rate figures, which describe that call and not yours.Paging.
page_sizefrom 1, default 50, maximum 200, a larger value lowered with the noticepage_size_lowered;page_tokenis opaque, bound to its query, alive 24 hours;next_page_tokenis absent on the last page, and a page that carries it holds at least one entry.Refused before any work. A value outside its set or range,
page_sizeabove its maximum excepted, which is lowered:400 invalid-request,not_allowedorbound, each with where it is. A token of another list:400 page-token-invalid. An unknown query parameter:400 invalid-request,unknown_field.Notices this operation makes.
page_size_lowered.Problem types.
- 400
invalid-request, The request is invalid;page-token-invalid, The page token is invalid. - 401
unauthorized, The key is missing or rejected. - 403
insufficient-scope, The key lacks a scope this call needs. - 429
rate-limit-exceeded, The rate limit is exceeded;concurrency-limit-exceeded, Too many calls are in flight. - 500
internal-error, The service failed. - 503
overloaded, The service is overloaded.
- 400
-
-
-
from getclean import GetClean from getclean.environment import GetCleanEnvironment client = GetClean( environment=GetCleanEnvironment.PRODUCTION, ) client.list_datasources( country="US", language="en", access="open", )
-
-
-
group:
typing.Optional[str]— Only this group,webor a group the catalog publishes, an open set, 1 to 64 characters. Default none.
-
country:
typing.Optional[str]— Only sources that cover this country, ISO 3166-1 alpha-2. Default none.
-
language:
typing.Optional[str]— Only sources that cover this language, BCP 47, 1 to 35 characters. Default none.
-
access:
typing.Optional[str]— Only sources reached this way:open, no login;registered, a login the account owner registers;paid, a fee per query. An open set. Default none.
-
page_size:
typing.Optional[int]— At most this many entries on the page, from 1; default 50; the maximum, 200, stands inLimits.bounds, and a larger value is lowered with the noticepage_size_lowered.
-
page_token:
typing.Optional[str]— The next page, as the last answer'snext_page_tokengave it; opaque, at most 1,024 characters, never built by the caller. Default none, the first page.
-
request_options:
typing.Optional[RequestOptions]— Request-specific configuration.
-
-
client.get_datasource(...) -> Datasource
-
-
-
Read one entry of the catalog whole, free; the answer may be cached for an hour. You get what the source covers, how it is reached, which filters and operators it honors, which identifier schemes it resolves and with which issuer codes, and whether it keeps history for
as_of_date.What it costs. The key needs
search:read. The call is free. The answer is200withDatasourceandCache-Control: max-age=3600.Refused before any work. An id of the wrong form, other than 1 to 64 of
a-z,0-9and_with a letter first:400 invalid-request,syntax, before any lookup. An unknown query parameter:400 invalid-request,unknown_field.Problem types.
- 400
invalid-request, The request is invalid. - 401
unauthorized, The key is missing or rejected. - 403
insufficient-scope, The key lacks a scope this call needs. - 404
not-found, Not found: no entry has this id. - 429
rate-limit-exceeded, The rate limit is exceeded;concurrency-limit-exceeded, Too many calls are in flight. - 500
internal-error, The service failed. - 503
overloaded, The service is overloaded.
- 400
-
-
-
from getclean import GetClean from getclean.environment import GetCleanEnvironment client = GetClean( environment=GetCleanEnvironment.PRODUCTION, ) client.get_datasource( datasource_id="courtlistener", )
-
-
-
datasource_id:
str— The catalog's id, 1 to 64 ofa-z,0-9and_, a letter first, aswebandcourtlistener.
-
request_options:
typing.Optional[RequestOptions]— Request-specific configuration.
-
-