> For the complete documentation index, see [llms.txt](https://docs.pgecom.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pgecom.com/api-endpoint/ecommerce/collection/getcollectionbyid.md).

# GetCollectionById

This endpoint is there to get collection by id

You'll need to replace the {{collectionId}} with the actual collection to fetch the API

<mark style="color:blue;">`GET`</mark> `https://sandbox.pgecom.com/api/v1/collection/{{collectionId}}`

{% tabs %}
{% tab title="200: OK Success" %}

```json
{
    "searchEngineDescription": "desc",
    "shopId": "5f56dfa3-a415-4818-8275-44fc63ece3fd",
    "searchEngineTitle": "Page Electronics",
    "updatedAt": "2023-03-03T23:45:25Z",
    "createdAt": "2023-03-03T23:45:25Z",
    "description": "Eletronics gadget",
    "id": "a20e63c3-47e8-489f-a68e-ca4bfdcefd2d",
    "name": "Electronics",
    "mainImageUrl": "https://pg-ecommerce-dev.s3.amazonaws.com/collection/c45ea8cc-7767-46f3-86a7-d9c1f576e715/137c797a75baa78dbbfae7f16ccc653e.jpg",
    "searchEngineUrl": "undefined",
    "products": []
}
```

{% endtab %}

{% tab title="404: Not Found Not found" %}

```json
{
    "message": "Collection with id a20e63c3-47e8-489f-a68e-ca4bfdcefd2 not found",
    "status": 404
}
```

{% endtab %}

{% tab title="429: Too Many Requests Too many request" %}

```json
{
    "message": "Too many requests, please try again later.",
    "status": 429
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const axios = require('axios');

let config = {
  method: 'get',
  url: 'https://sandbox.pgecom.com/api/v1/storefront/collection/a20e63c3-47e8-489f-a68e-ca4bfdcefd2',
  headers: { }
};

axios(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});

```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://sandbox.pgecom.com/api/v1/storefront/collection/a20e63c3-47e8-489f-a68e-ca4bfdcefd2"

payload = {}
headers = {}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require "uri"
require "net/http"

url = URI("https://sandbox.pgecom.com/api/v1/storefront/collection/a20e63c3-47e8-489f-a68e-ca4bfdcefd2")

http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body

```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://sandbox.pgecom.com/api/v1/storefront/collection/a20e63c3-47e8-489f-a68e-ca4bfdcefd2');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
try {
  $response = $request->send();
  if ($response->getStatus() == 200) {
    echo $response->getBody();
  }
  else {
    echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
    $response->getReasonPhrase();
  }
}
catch(HTTP_Request2_Exception $e) {
  echo 'Error: ' . $e->getMessage();
}
```

{% endtab %}

{% tab title="Curl" %}

```javascript
curl --location 'https://sandbox.pgecom.com/api/v1/storefront/collection/a20e63c3-47e8-489f-a68e-ca4bfdcefd2
```

{% endtab %}
{% endtabs %}
