> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zenrows.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Making your first request with the Go SDK

> Make your first request with the ZenRows Go SDK in a few lines of code.

This guide makes a single GET request with the ZenRows Go SDK: create a client, send the request, read the response.

<Note>Haven't installed the SDK yet? Follow [Installation](/universal-scraper-api/sdk/go/installation) first.</Note>

## Basic usage

<Steps>
  <Step title="Create a client">
    Import the `scraperapi` package and instantiate a client with your API key:

    ```go theme={null} theme={null}
    package main

    import (
        scraperapi "github.com/zenrows/zenrows-go-sdk/service/api"
    )

    func main() {
        client := scraperapi.NewClient(
            scraperapi.WithAPIKey("YOUR_ZENROWS_API_KEY"),
        )
    }
    ```
  </Step>

  <Step title="Send a GET request">
    Call `client.Get()` with a `context.Context` and the URL you want to scrape:

    ```go theme={null} theme={null}
    package main

    import (
        "context"
        "fmt"
        "log"

        scraperapi "github.com/zenrows/zenrows-go-sdk/service/api"
    )

    func main() {
        client := scraperapi.NewClient(
            scraperapi.WithAPIKey("YOUR_ZENROWS_API_KEY"),
        )

        response, err := client.Get(context.Background(), "https://www.scrapingcourse.com/ecommerce/", nil)
        if err != nil {
            log.Fatal(err)
        }

        fmt.Println(response.String())
    }
    ```

    `response` is a `*scraperapi.Response`, a thin wrapper that also exposes the original `*http.Response`.

    <Tip>See [The Response Object](/universal-scraper-api/sdk/go/response-object) for everything available on it.</Tip>
  </Step>

  <Step title="Add request parameters">
    Pass a `*scraperapi.RequestParameters` instead of `nil` to enable Universal Scraper API features like JavaScript rendering or Premium Proxies:

    ```go theme={null} theme={null}
    package main

    import (
        "context"
        "fmt"
        "log"

        scraperapi "github.com/zenrows/zenrows-go-sdk/service/api"
    )

    func main() {
        client := scraperapi.NewClient(
            scraperapi.WithAPIKey("YOUR_ZENROWS_API_KEY"),
        )

        response, err := client.Get(context.Background(), "https://www.scrapingcourse.com/ecommerce/", &scraperapi.RequestParameters{
            JSRender:          true,
            UsePremiumProxies: true,
            ProxyCountry:      "us",
        })
        if err != nil {
            log.Fatal(err)
        }

        fmt.Println(response.String())
    }
    ```

    <Tip>
      `RequestParameters` exposes every parameter documented in the [Universal Scraper API setup guide](/universal-scraper-api/universal-scraper-api-setup), including `AutoParse`, `CSSExtractor`, `WaitForSelector`, `BlockResources`, and `Outputs`. They all work exactly the same way through the SDK.
    </Tip>
  </Step>

  <Step title="Check the result">
    Since the SDK doesn't turn a non-2xx response into a Go `error`, always check the status before using the content:

    ```go theme={null} theme={null}
    if response.IsSuccess() {
        fmt.Println(response.String())
    } else {
        fmt.Println("Request failed with status", response.StatusCode())
    }
    ```

    See [Error Handling and Retries](/universal-scraper-api/sdk/go/error-handling-and-retries) for how to configure automatic retries so you don't have to handle every transient failure manually.
  </Step>
</Steps>

## Troubleshooting

* **`response.StatusCode()` is `401` or similar auth error**: Double-check your API key was copied correctly from the [ZenRows Request Builder](https://app.zenrows.com/builder) with no extra whitespace. See [`AUTH002`](/api-error-codes#auth002-invalid-api-key).
* **`response.String()` is empty or looks like an error page, not the target site**: The target likely needs `JSRender: true` and/or `UsePremiumProxies: true`. See [`REQS002`](/api-error-codes#reqs002-request-requirements-unsatisfied).
* **Request hangs for a long time**: Pass a `context.Context` created with `context.WithTimeout(...)`. We recommend not going below 3 minutes for protected sites using `JSRender`.
* **`429 Too Many Requests`**: You've hit your plan's concurrency or rate limit. See [Concurrency](/universal-scraper-api/sdk/go/async-concurrency).

## Pricing

Cost depends on the parameters you send, not on the SDK itself:

| Configuration                                     | Cost multiplier vs. basic |
| ------------------------------------------------- | ------------------------- |
| Basic request (no `JSRender`/`UsePremiumProxies`) | 1x                        |
| `JSRender: true`                                  | 5x                        |
| `UsePremiumProxies: true`                         | 10x                       |
| `JSRender: true` + `UsePremiumProxies: true`      | 25x                       |

Only successful requests are billed. See [ZenRows Pricing](/first-steps/pricing) for exact per-plan rates.

## FAQ (Frequently Asked Questions)

<AccordionGroup>
  <Accordion title="Do I need to pass params for every request?">
    No, passing `nil` is valid, it's the same as an empty `&scraperapi.RequestParameters{}`.
  </Accordion>

  <Accordion title="Why doesn't a failed request return a Go error?">
    By design, the SDK returns a `*Response` even for error status codes. Check `response.IsSuccess()` or `response.StatusCode()` yourself. See [Error Handling and Retries](/universal-scraper-api/sdk/go/error-handling-and-retries).
  </Accordion>

  <Accordion title="Can I reuse the same client for multiple requests?">
    Yes. Create one `*scraperapi.Client` and call `.Get()`/`.Post()`/`.Put()` on it as many times as needed, there's no need to recreate it per request. It's also safe to share across goroutines.
  </Accordion>
</AccordionGroup>

## What's next

<CardGroup cols={3}>
  <Card title="POST and PUT Requests" icon="send" href="/universal-scraper-api/sdk/go/post-put-requests">
    Submit forms or data payloads.
  </Card>

  <Card title="Concurrency" icon="bolt" href="/universal-scraper-api/sdk/go/async-concurrency">
    Scrape many URLs in parallel.
  </Card>

  <Card title="Custom Headers" icon="tags" href="/universal-scraper-api/sdk/go/custom-headers">
    Forward specific headers to the target site.
  </Card>
</CardGroup>
