# Method: ampUrls.batchGet

- [HTTP request](https://developers.google.com/amp/cache/reference/acceleratedmobilepageurl/rest/v1/ampUrls/batchGet#body.HTTP_TEMPLATE)
- [Request body](https://developers.google.com/amp/cache/reference/acceleratedmobilepageurl/rest/v1/ampUrls/batchGet#body.request_body)
  - [JSON representation](https://developers.google.com/amp/cache/reference/acceleratedmobilepageurl/rest/v1/ampUrls/batchGet#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://developers.google.com/amp/cache/reference/acceleratedmobilepageurl/rest/v1/ampUrls/batchGet#body.response_body)
  - [JSON representation](https://developers.google.com/amp/cache/reference/acceleratedmobilepageurl/rest/v1/ampUrls/batchGet#body.BatchGetAmpUrlsResponse.SCHEMA_REPRESENTATION)
- [LookupStrategy](https://developers.google.com/amp/cache/reference/acceleratedmobilepageurl/rest/v1/ampUrls/batchGet#LookupStrategy)
- [AmpUrl](https://developers.google.com/amp/cache/reference/acceleratedmobilepageurl/rest/v1/ampUrls/batchGet#AmpUrl)
  - [JSON representation](https://developers.google.com/amp/cache/reference/acceleratedmobilepageurl/rest/v1/ampUrls/batchGet#AmpUrl.SCHEMA_REPRESENTATION)
- [AmpUrlError](https://developers.google.com/amp/cache/reference/acceleratedmobilepageurl/rest/v1/ampUrls/batchGet#AmpUrlError)
  - [JSON representation](https://developers.google.com/amp/cache/reference/acceleratedmobilepageurl/rest/v1/ampUrls/batchGet#AmpUrlError.SCHEMA_REPRESENTATION)
- [ErrorCode](https://developers.google.com/amp/cache/reference/acceleratedmobilepageurl/rest/v1/ampUrls/batchGet#ErrorCode)
- [Try it!](https://developers.google.com/amp/cache/reference/acceleratedmobilepageurl/rest/v1/ampUrls/batchGet#try-it)

Returns AMP URL(s) and equivalent [AMP Cache URL(s)](https://developers.google.com/amp/cache/overview#amp-cache-url-format).

### HTTP request

`POST https://acceleratedmobilepageurl.googleapis.com/v1/ampUrls:batchGet`

The URL uses [Google API HTTP annotation](https://github.com/googleapis/googleapis/blob/master/google/api/http.proto) syntax.

### Request body

The request body contains data with the following structure:

| JSON representation ||
|---|---|
| ``` { "urls": [ string ] "lookupStrategy": enum(LookupStrategy), } ``` |

| Fields ||
|---|---|
| `urls[]` | `string` List of URLs to look up for the paired AMP URLs. The URLs are case-sensitive. Up to 50 URLs per lookup (see [Usage Limits](https://developers.google.com/amp/cache/reference/limits)). |
| `lookupStrategy` | ``enum(`https://developers.google.com/amp/cache/reference/acceleratedmobilepageurl/rest/v1/ampUrls/batchGet#LookupStrategy`)`` The lookupStrategy being requested. |

### Response body

If successful, the response body contains data with the following structure:
Batch AMP URL response.

| JSON representation ||
|---|---|
| ``` { "ampUrls": [ { object(AmpUrl) } ], "urlErrors": [ { object(AmpUrlError) } ], } ``` |

| Fields ||
|---|---|
| `ampUrls[]` | ``object(`https://developers.google.com/amp/cache/reference/acceleratedmobilepageurl/rest/v1/ampUrls/batchGet#AmpUrl`)`` For each URL in BatchAmpUrlsRequest, the URL response. The response might not be in the same order as URLs in the batch request. If BatchAmpUrlsRequest contains duplicate URLs, AmpUrl is generated only once. |
| `urlErrors[]` | ``object(`https://developers.google.com/amp/cache/reference/acceleratedmobilepageurl/rest/v1/ampUrls/batchGet#AmpUrlError`)`` The errors for requested URLs that have no AMP URL. |

## LookupStrategy

| Enums ||
|---|---|
| `FETCH_LIVE_DOC` | FETCH_LIVE_DOC strategy involves live document fetch of URLs not found in the index. Any request URL not found in the index is crawled in realtime to validate if there is a corresponding AMP URL. This strategy has higher coverage but with extra latency introduced by realtime crawling. This is the default strategy. Applications using this strategy should set higher HTTP timeouts of the API calls. |
| `IN_INDEX_DOC` | IN_INDEX_DOC strategy skips fetching live documents of URL(s) not found in index. For applications which need low latency use of IN_INDEX_DOC strategy is recommended. |

## AmpUrl

AMP URL response for a requested URL.

| JSON representation ||
|---|---|
| ``` { "originalUrl": string, "ampUrl": string, "cdnAmpUrl": string, } ``` |

| Fields ||
|---|---|
| `originalUrl` | `string` The original non-AMP URL. |
| `ampUrl` | `string` The AMP URL pointing to the publisher's web server. |
| `cdnAmpUrl` | `string` The [AMP Cache URL](https://developers.google.com/amp/cache/overview#amp-cache-url-format) pointing to the cached document in the Google AMP Cache. |

## AmpUrlError

AMP URL Error resource for a requested URL that couldn't be found.

| JSON representation ||
|---|---|
| ``` { "errorCode": enum(ErrorCode), "errorMessage": string, "originalUrl": string, } ``` |

| Fields ||
|---|---|
| `errorCode` | ``enum(`https://developers.google.com/amp/cache/reference/acceleratedmobilepageurl/rest/v1/ampUrls/batchGet#ErrorCode`)`` The error code of an API call. |
| `errorMessage` | `string` An optional descriptive error message. |
| `originalUrl` | `string` The original non-AMP URL. |

## ErrorCode

Error codes for a batch AMP URL lookup.

| Enums ||
|---|---|
| `ERROR_CODE_UNSPECIFIED` | Not specified error. |
| `INPUT_URL_NOT_FOUND` | Indicates the requested URL is not found in the index, possibly because it's unable to be found, not able to be accessed by Googlebot, or some other error. |
| `NO_AMP_URL` | Indicates no AMP URL has been found that corresponds to the requested URL. |
| `APPLICATION_ERROR` | Indicates some kind of application error occurred at the server. Client advised to retry. |
| `URL_IS_VALID_AMP` | DEPRECATED: Indicates the requested URL is a valid AMP URL. This is a non-error state, should not be relied upon as a sign of success or failure. It will be removed in future versions of the API. |
| `URL_IS_INVALID_AMP` | Indicates that an AMP URL has been found that corresponds to the request URL, but it is not valid AMP HTML. |

## Try it!