% Generated by roxygen2: do not edit by hand % Please edit documentation in R/api.R \name{cep_lookup_many} \alias{cep_lookup_many} \title{Look up many CEPs in one request} \usage{ cep_lookup_many(ceps, client = default_client()) } \arguments{ \item{ceps}{A character vector of CEPs, masked or unmasked.} \item{client}{A \code{\link[=cepis_client]{cepis_client()}}. Defaults to a shared client built with the default configuration.} } \value{ A list of \strong{the same length and in the same order} as \code{ceps}. Each element is a \link{cepis_address}, or \code{NULL} where the CEP does not exist or is malformed — it does not vanish from the list, and it does not signal a condition. That is the right difference from \code{\link[=cep_lookup]{cep_lookup()}}: in a batch of a thousand, one bad CEP must not cost the other nine hundred and ninety-nine. Use \code{\link[=normalize_cep]{normalize_cep()}} beforehand if you need to know \emph{which} input was malformed. A list rather than a \code{data.frame} because \code{NULL} is the only unambiguous "no such CEP" in R: a row of \code{NA}s reads as an address with unknown fields, which is a different statement, and an empty row cannot be told apart from a CEP the database knows only by number. Rectangle it with \code{do.call(rbind, lapply(result, function(a) as.data.frame(a[1:13])))} when a \code{data.frame} is what you want. } \description{ Resolves up to 500 CEPs per request, chunking longer inputs automatically. Do not loop over \code{\link[=cep_lookup]{cep_lookup()}}: a loop of 500 calls pays 500 TLS handshakes, the batch pays one. } \section{Batches carry no coordinate}{ The endpoint behind them is CSV, and the CSV has no \code{geo} column. Every address returned here has \code{geo = NULL}, including for CEPs that do have one. Need \code{geo}? Use \code{\link[=cep_lookup]{cep_lookup()}}, one at a time. } \examples{ \donttest{ ceps <- c("01001000", "99999999", "20040020") result <- cep_lookup_many(ceps) vapply(result, function(a) if (is.null(a)) NA_character_ else a$localidade, character(1)) } }