1"use strict";(globalThis.webpackChunk_atlas_docs_zen=globalThis.webpackChunk_atlas_docs_zen||[]).push([[3513],{4056(e,n,r){r.d(n,{R:()=>o,x:()=>l});var s=r(2155);const i={},t=s.createContext(i);function o(e){const n=s.useContext(t);return s.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:o(e.components),s.createElement(t.Provider,{value:n},e.children)}},6468(e,n,r){r.r(n),r.d(n,{assets:()=>d,contentTitle:()=>l,default:()=>h,frontMatter:()=>o,metadata:()=>s,toc:()=>c});const s=JSON.parse('{"id":"cli/phone","title":"azn phone","description":"Validate phone numbers: GET /phonenumbers. Requires apikey. Each input counts as a paid lookup.","source":"@site/docs/cli/phone.mdx","sourceDirName":"cli","slug":"/cli/phone","permalink":"/docs/cli/phone","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":6,"frontMatter":{"title":"azn phone","sidebar_label":"phone","sidebar_position":6},"sidebar":"cli","previous":{"title":"email","permalink":"/docs/cli/email"},"next":{"title":"find & resolve","permalink":"/docs/cli/find"}}');var i=r(5723),t=r(4056);const o={title:"azn phone",sidebar_label:"phone",sidebar_position:6},l=void 0,d={},c=[{value:"Usage",id:"usage",level:2},{value:"Output",id:"output",level:2},{value:"Agent patterns",id:"agent-patterns",level:2},{value:"Error codes",id:"error-codes",level:2}];function a(e){const n={code:"code",h2:"h2",li:"li",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,t.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.p,{children:["Validate phone numbers: ",(0,i.jsx)(n.code,{children:"GET /phone_numbers"}),". Requires ",(0,i.jsx)(n.code,{children:"api_key"}),". Each input counts as a paid lookup."]}),"\n",(0,i.jsx)(n.h2,{id:"usage",children:"Usage"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{children:"azn phone [options] [query]\nazn phone --file input.txt\nazn phone --stdin\n"})}),"\n",(0,i.jsxs)(n.table,{children:[(0,i.jsx)(n.thead,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.th,{children:"Flag"}),(0,i.jsx)(n.th,{children:"Description"})]})}),(0,i.jsxs)(n.tbody,{children:[(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"-f, --file <path>"})}),(0,i.jsx)(n.td,{children:"Read one phone number per line"})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"--stdin"})}),(0,i.jsx)(n.td,{children:"Read one phone number per line from stdin"})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"-o, --out <path>"})}),(0,i.jsx)(n.td,{children:"Write CSV to a file (batch mode only)"})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:(0,i.jsx)(n.code,{children:"--carrier"})}),(0,i.jsx)(n.td,{children:"Look up the current network carrier (slower)"})]})]})]}),"\n",(0,i.jsxs)(n.p,{children:["Exactly one of: ",(0,i.jsx)(n.code,{children:"[query]"}),", ",(0,i.jsx)(n.code,{children:"--file"}),", ",(0,i.jsx)(n.code,{children:"--stdin"}),". Requests are tagged ",(0,i.jsx)(n.code,{children:"cli"}),"."]}),"\n",(0,i.jsxs)(n.p,{children:["Include the country code (for example ",(0,i.jsx)(n.code,{children:"+12025550173"}),") for reliable parsing."]}),"\n",(0,i.jsx)(n.h2,{id:"output",children:"Output"}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.strong,{children:"Single input"})," (always JSON):"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",children:'{\n "query": "+12025550173",\n "response": {\n "result": {\n "valid": true,\n "national_format": "(202) 555-0173",\n "international_format": "+1 202-555-0173",\n "iso_country": "USA",\n "iso_country_2": "US",\n "country": "United States",\n "current_carrier": { "name": null },\n "original_carrier": { "name": "Example Telecom", "network_type": "landline" }\n }\n }\n}\n'})}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"current_carrier"})," is only populated when ",(0,i.jsx)(n.code,{children:"--carrier"})," is passed (an HLR lookup that is slower and may cost more). Unparseable numbers return ",(0,i.jsx)(n.code,{children:'"valid": false'})," with the format fields blank."]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.strong,{children:"Multiple inputs"})," (file or stdin) emit CSV by default; pass ",(0,i.jsx)(n.code,{children:"--json"})," for the ",(0,i.jsx)(n.code,{children:"{ count, results: [{ query, response }] }"})," shape. CSV columns (carriers flattened to their name):"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{children:"query,status,valid,national_format,international_format,iso_country,iso_country_2,country,current_carrier,original_carrier\n"})}),"\n",(0,i.jsxs)(n.p,{children:["A row that fails its lookup doesn't abort the batch: in CSV its ",(0,i.jsx)(n.code,{children:"status"})," becomes ",(0,i.jsx)(n.code,{children:"Error: <message>"}),"; in JSON its entry is ",(0,i.jsx)(n.code,{children:"{ query, error: { code, message } }"}),". The batch still exits ",(0,i.jsx)(n.code,{children:"0"}),"; filter on ",(0,i.jsx)(n.code,{children:"status"})," or the ",(0,i.jsx)(n.code,{children:"error"})," key to find failures. Auth/permission failures (",(0,i.jsx)(n.code,{children:"auth_failed"}),", ",(0,i.jsx)(n.code,{children:"forbidden"}),") are the exception: they abort the whole run since every row would fail identically."]}),"\n",(0,i.jsx)(n.h2,{id:"agent-patterns",children:"Agent patterns"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"# Single \u2014 is it val
1id?\nazn phone \"+12025550173\" | jq .response.result.valid\n\n# Batch to CSV\ncat numbers.txt | azn phone --stdin > numbers.csv\n\n# Filter invalid numbers from a batch\ncat numbers.txt | azn phone --stdin --json | jq '.results[] | select(.response.result.valid == false) | .query'\n"})}),"\n",(0,i.jsx)(n.h2,{id:"error-codes",children:"Error codes"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"missing_argument"}),": no ",(0,i.jsx)(n.code,{children:"[query]"}),", ",(0,i.jsx)(n.code,{children:"--file"}),", or ",(0,i.jsx)(n.code,{children:"--stdin"})," supplied"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"auth_failed"}),": invalid key, or key lacks paid phone validation permission"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"rate_limited"}),": back off and retry"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"invalid_input"}),": malformed request rejected by the API"]}),"\n"]})]})}function h(e={}){const{wrapper:n}={...(0,t.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(a,{...e})}):a(e)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.