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

# Quickstart

> Create your first artifact in 2 minutes

<Steps>
  <Step title="Get your API key">
    Sign in to your [dashboard](https://genui.sh/dashboard) and copy your API key from the settings page.

    Your API key starts with `genui_` and should be kept secure.
  </Step>

  <Step title="Create and share an artifact">
    Make a single POST request to create your artifact and get a shareable URL:

    <CodeGroup>
      ```bash curl theme={null}
      curl -X POST https://genui.sh/api/artifacts/share \
        -H "Authorization: Bearer YOUR_API_KEY" \
        -H "Content-Type: application/json" \
        -d '{
          "template": "markdown",
          "title": "Hello World",
          "content": {"text": "# Hello World\n\nThis is my first artifact!"}
        }'
      ```

      ```python Python theme={null}
      import requests

      response = requests.post(
          "https://genui.sh/api/artifacts/share",
          headers={"Authorization": "Bearer YOUR_API_KEY"},
          json={
              "template": "markdown",
              "title": "Hello World",
              "content": {"text": "# Hello World\n\nThis is my first artifact!"}
          }
      )
      print(response.json()["url"])
      ```

      ```javascript JavaScript theme={null}
      const response = await fetch('https://genui.sh/api/artifacts/share', {
        method: 'POST',
        headers: {
          'Authorization': 'Bearer YOUR_API_KEY',
          'Content-Type': 'application/json'
        },
        body: JSON.stringify({
          template: 'markdown',
          title: 'Hello World',
          content: { text: '# Hello World\n\nThis is my first artifact!' }
        })
      });
      const { url } = await response.json();
      console.log(url);
      ```

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

      import (
          "bytes"
          "encoding/json"
          "fmt"
          "io"
          "net/http"
      )

      func main() {
          payload := map[string]interface{}{
              "template": "markdown",
              "title":    "Hello World",
              "content":  map[string]string{"text": "# Hello World\n\nThis is my first artifact!"},
          }
          body, _ := json.Marshal(payload)

          req, _ := http.NewRequest("POST", "https://genui.sh/api/artifacts/share", bytes.NewBuffer(body))
          req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
          req.Header.Set("Content-Type", "application/json")

          client := &http.Client{}
          resp, _ := client.Do(req)
          defer resp.Body.Close()

          respBody, _ := io.ReadAll(resp.Body)
          var result map[string]interface{}
          json.Unmarshal(respBody, &result)
          fmt.Println(result["url"])
      }
      ```

      ```ruby Ruby theme={null}
      require 'net/http'
      require 'json'
      require 'uri'

      uri = URI('https://genui.sh/api/artifacts/share')
      http = Net::HTTP.new(uri.host, uri.port)
      http.use_ssl = true

      request = Net::HTTP::Post.new(uri)
      request['Authorization'] = 'Bearer YOUR_API_KEY'
      request['Content-Type'] = 'application/json'
      request.body = {
        template: 'markdown',
        title: 'Hello World',
        content: { text: '# Hello World\n\nThis is my first artifact!' }
      }.to_json

      response = http.request(request)
      result = JSON.parse(response.body)
      puts result['url']
      ```

      ```rust Rust theme={null}
      use reqwest::header::{AUTHORIZATION, CONTENT_TYPE};
      use serde_json::json;

      #[tokio::main]
      async fn main() -> Result<(), Box<dyn std::error::Error>> {
          let client = reqwest::Client::new();
          let response = client
              .post("https://genui.sh/api/artifacts/share")
              .header(AUTHORIZATION, "Bearer YOUR_API_KEY")
              .header(CONTENT_TYPE, "application/json")
              .json(&json!({
                  "template": "markdown",
                  "title": "Hello World",
                  "content": {"text": "# Hello World\n\nThis is my first artifact!"}
              }))
              .send()
              .await?;

          let result: serde_json::Value = response.json().await?;
          println!("{}", result["url"]);
          Ok(())
      }
      ```

      ```csharp .NET theme={null}
      using System.Net.Http.Json;
      using System.Text.Json;

      var client = new HttpClient();
      client.DefaultRequestHeaders.Add("Authorization", "Bearer YOUR_API_KEY");

      var response = await client.PostAsJsonAsync("https://genui.sh/api/artifacts/share", new {
          template = "markdown",
          title = "Hello World",
          content = new { text = "# Hello World\n\nThis is my first artifact!" }
      });

      var result = await response.Content.ReadFromJsonAsync<JsonElement>();
      Console.WriteLine(result.GetProperty("url").GetString());
      ```
    </CodeGroup>

    You'll receive a response with your artifact and shareable URL:

    ```json theme={null}
    {
      "id": "art_abc123",
      "url": "https://genui.sh/a/art_abc123?token=xyz...",
      "expiresAt": "2024-01-22T12:00:00Z"
    }
    ```
  </Step>
</Steps>

## Next Steps

<CardGroup cols={2}>
  <Card title="Authentication" icon="key" href="/authentication">
    Learn about API key management
  </Card>

  <Card title="Templates" icon="shapes" href="/templates/overview">
    Explore all available templates
  </Card>

  <Card title="API Reference" icon="code" href="/api-reference/introduction">
    Full API documentation
  </Card>

  <Card title="Playground" icon="play" href="https://genui.sh/dashboard/playground">
    Try the API interactively
  </Card>
</CardGroup>
