# GET Polling Data

## Endpoint

<mark style="color:blue;">`GET`</mark> `https://api.spacely.ai/api/v1/generate/poll-result?refId={{refId}}`

This endpoint is used to fetch result from standard and advance generate

#### Path Parameters

| Name                                    | Type   | Description                              |
| --------------------------------------- | ------ | ---------------------------------------- |
| refId<mark style="color:red;">\*</mark> | String | Refid after stansard or advance generate |

#### Headers

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| X-API-KEY<mark style="color:red;">\*</mark> | String |             |

{% tabs %}
{% tab title="200: OK Response status success" %}

```json
{
  "data": {
    "status": "success",
    "result": [
      "https://storage.googleapis.com/spacely-enterprise/c18302f5-a9de-422d-000/ea6abee1-ed4b-4ca8-994e-2c215150bf9e-1.png",
      "https://storage.googleapis.com/spacely-enterprise/c18302f5-a9de-422d-000/ea6abee1-ed4b-4ca8-994e-2c215150bf9e-2.png",
      "https://storage.googleapis.com/spacely-enterprise/c18302f5-a9de-422d-000/ea6abee1-ed4b-4ca8-994e-2c215150bf9e-3.png",
      "https://storage.googleapis.com/spacely-enterprise/c18302f5-a9de-422d-000/ea6abee1-ed4b-4ca8-994e-2c215150bf9e-4.png"
    ]
  }
}
```

{% endtab %}

{% tab title="200: OK Response status processing" %}

```json
{
  "data": {
    "status": "processing",
    "result": []
  }
}
```

{% endtab %}

{% tab title="400: Bad Request Not Found: Requested resource not found on the server." %}

{% endtab %}

{% tab title="401: Unauthorized The API key provided was invalid or missing." %}

{% endtab %}

{% tab title="500: Internal Server Error Unexpected condition on the server preventing request fulfillment." %}

{% endtab %}
{% endtabs %}

## Example

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

```sh

curl --location 'https://api.spacely.ai/api/v1/generate/poll-result?refId=REF_ID' \
--header 'X-API-KEY: YOUR_API_KEY'
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
var myHeaders = new Headers();
myHeaders.append("X-API-KEY", YOUR_API_KEY);

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("https://api.spacely.ai/api/v1/generate/poll-result?refId=068e3933-4aeb-4b4d-a473-9f8fa9f2d20a", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
```

{% endtab %}

{% tab title="NodeJs" %}

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

let config = {
  method: 'get',
  maxBodyLength: Infinity,
  url: 'https://api.spacely.ai/api/v1/generate/poll-result?refId=REF_ID',
  headers: { 
    'X-API-KEY': YOUR_API_KEY
  }
};

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

```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.spacely.ai/api/v1/generate/poll-result?refId=REF_ID"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("X-API-KEY", YOUR_API_KEY)

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.spacely.ai/api/v1/generate/poll-result?refId=REF_ID"

payload = {}
headers = {
  'X-API-KEY': YOUR_API_KEY
}

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

print(response.text)

```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.enterprise.spacely.ai/spacely-ai-enterprise-old/api-endpoints/get-polling-data.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
