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

# Extract brands from URLs

> Extract brand fields from one exact webpage without domain resolution, database lookup, or cross-source enrichment.

Use `by_direct_url` when Context.dev should read one specific page, such as a campaign, preview environment, regional site, or deep product page.

<Warning>
  This lookup reads only the URL you provide. It does not resolve the wider domain or combine cross-source data, so the returned profile can be much sparser than a domain lookup.
</Warning>

## Send a URL

```bash theme={null}
export CONTEXT_DEV_API_KEY="ctxt_secret_..."
```

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.context.dev/v1/brand/retrieve \
    --request POST \
    --header "Authorization: Bearer $CONTEXT_DEV_API_KEY" \
    --header "Content-Type: application/json" \
    --data '{
      "type": "by_direct_url",
      "direct_url": "https://stripe.com/enterprise"
    }'
  ```

  ```typescript TypeScript theme={null}
  import ContextDev from "context.dev";

  const client = new ContextDev({
    apiKey: process.env.CONTEXT_DEV_API_KEY,
  });

  const response = await client.brand.retrieve({
    type: "by_direct_url",
    direct_url: "https://stripe.com/enterprise",
  });

  console.log(response.brand?.title, response.brand?.logos);
  ```

  ```python Python theme={null}
  import os
  from context.dev import ContextDev

  client = ContextDev(api_key=os.environ["CONTEXT_DEV_API_KEY"])

  response = client.brand.retrieve(
      type="by_direct_url",
      direct_url="https://stripe.com/enterprise",
  )

  print(response.brand.title if response.brand else None)
  ```

  ```ruby Ruby theme={null}
  require "cgi/core"
  require "context_dev"

  client = ContextDev::Client.new(
    api_key: ENV.fetch("CONTEXT_DEV_API_KEY")
  )

  response = client.brand.retrieve(
    body: {
      type: :by_direct_url,
      direct_url: "https://stripe.com/enterprise",
    }
  )

  puts response.brand&.title
  ```

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

  import (
      "context"
      "fmt"
      "os"

      contextdev "github.com/context-dot-dev/context-go-sdk/v2"
      "github.com/context-dot-dev/context-go-sdk/v2/option"
  )

  func main() {
      client := contextdev.NewClient(
          option.WithAPIKey(os.Getenv("CONTEXT_DEV_API_KEY")),
      )

      response, err := client.Brand.Get(
          context.Background(),
          contextdev.BrandGetParams{
              OfByDirectURL: &contextdev.BrandGetParamsBodyByDirectURL{
                  DirectURL: "https://stripe.com/enterprise",
              },
          },
      )
      if err != nil {
          panic(err)
      }

      fmt.Println(response.Brand.Title)
  }
  ```

  ```php PHP theme={null}
  <?php

  require __DIR__.'/vendor/autoload.php';

  use ContextDev\Client;

  $client = new Client(apiKey: getenv('CONTEXT_DEV_API_KEY'));

  // Use the SDK's low-level request method until the Brand helper is fixed.
  $raw = $client->request(
      method: 'post',
      path: 'brand/retrieve',
      body: [
          'type' => 'by_direct_url',
          'direct_url' => 'https://stripe.com/enterprise',
      ],
  );

  $response = json_decode((string) $raw->getBody(), true, flags: JSON_THROW_ON_ERROR);
  echo $response['brand']['title'] ?? 'No brand found', PHP_EOL;
  ```
</CodeGroup>

<Note>
  The PHP tab uses the SDK's low-level request method because the `2.14.0` Brand helper requires conflicting lookup fields. See the [PHP guide](/sdks/php) for details.
</Note>

The endpoint costs 10 credits.

## Supported controls

The direct URL variant accepts `type`, `direct_url`, `timeoutMS`, and `tags`.

It rejects `maxAgeMs`, `maxSpeed`, and `force_language`. Those controls belong to resolver-backed lookup variants and do not apply to this one-page flow.

## Handle sparse results

Only use fields that the page exposes. A successful response can omit the assets or company details that a wider domain lookup would find.

If the page cannot be fetched, inspect the `400` response and its `error_code` before retrying.

## Next steps

<CardGroup cols={2}>
  <Card title="Retrieve brands by domain" icon="building" href="/guides/retrieve-brand-by-domain">
    Let the resolver identify the company and assemble a broader profile.
  </Card>

  <Card title="Scrape a webpage" icon="globe" href="/guides/scrape-websites-to-markdown">
    Read the page's content instead of its brand fields.
  </Card>

  <Card title="Troubleshooting" icon="wrench" href="/optimization/troubleshooting">
    Review current failure categories before choosing a retry policy.
  </Card>

  <Card title="Brand API reference" icon="code" href="/api-reference/brand-intelligence/brand">
    Review the full request and response contract.
  </Card>
</CardGroup>
