Author: meowmeowscratch

  • Connect an AI Agent to Meow Meow Scratch with MCP

    Connect Codex or Claude Code to the hosted Meow MCP server, verify the connection with read-only tools and set a clear approval boundary before the agent changes anything.

    MCP gives a compatible AI client schema-defined tools for discovering and managing your Meow Meow Scratch® resources. Instead of asking an agent to invent HTTP requests, you can let it call named tools with validated inputs and structured results.

    What MCP adds

    You
     │  natural-language request
     ▼
    Codex or Claude Code
     │  schema-validated MCP tool call
     │  Authorization: Bearer [platform token]
     ▼
    https://meowmeowscratch.com/mcp/
     │  authenticated Meow API request
     ▼
    Apps, endpoints, records, dashboards and integrations

    MCP changes the interface, not the underlying permissions. The agent can call only the tools the server exposes, and the platform token still determines which Meow resource routes are available.

    MCP does not make an agent automatically trustworthy, add a draft mode to API resources or create a server-side human approval prompt. The client and the person operating it remain responsible for reviewing sensitive actions.

    The trust boundary

    ComponentWhat it can see or doYour responsibility
    Agent clientReceives your prompt, discovers tools and submits tool callsUse a trusted installation and an appropriate approval policy.
    Agent Tools pluginAdds the shared workflow instructions and MCP configurationReview the source and release notes before installing updates.
    Hosted MCP serverReceives the Bearer token and translates tool calls into Meow resource operationsUse the exact HTTPS endpoint and protect the token.
    Meow APIEnforces authentication, validation, limits and resource permissionsKeep resources private unless anonymous access is intentional.

    The hosted server cannot use API credentials to access identity, profile, platform-token management or billing subscription routes. Manage those in the web app.

    Before you start

    • A Meow Meow Scratch account
    • Codex or Claude Code installed
    • Permission to add a plugin or MCP server in your environment
    • A platform token created under Account → Platform Tokens

    Use a platform token for MCP because the tool set performs discovery across your account. An app API key is intentionally restricted to one app and is better suited to a Raspberry Pi, deployed device or single-app integration.

    Never place the token in a repository, prompt, screenshot, MCP URL or committed configuration file. The configuration should contain only the environment-variable name.

    For a temporary Bash, zsh, Git Bash or WSL session, enter the token without putting it in shell history:

    read -s MEOW_PLATFORM_API_KEY
    export MEOW_PLATFORM_API_KEY

    Paste the token when the terminal waits, press Enter, then run the export command. Launch the agent from that same terminal so it inherits the variable.

    Option 1: install the official Agent Tools plugin

    This is the recommended setup. The official Meow Agent Tools repository packages both the hosted connection and the shared use-meow workflow.

    Codex

    codex plugin marketplace add meowmeowscratch/meow-agent-tools
    codex plugin add meow-meow-scratch@meow-agent-tools

    Start a new Codex thread after installation. Ask for a Meow task naturally, or run /mcp if the tools do not appear.

    Claude Code

    claude plugin marketplace add meowmeowscratch/meow-agent-tools
    claude plugin install meow-meow-scratch@meow-agent-tools

    Start a new Claude Code session or run /reload-plugins. Verify the server with /mcp. When explicit selection is useful, invoke the shared skill with:

    /meow-meow-scratch:use-meow

    This package supports Claude Code. It does not define a Claude.ai or Claude Desktop connector.

    Option 2: configure only the MCP connection

    Use manual configuration when you want the tools without the packaged workflow instructions.

    Standalone Codex configuration

    codex mcp add meow \
      --url https://meowmeowscratch.com/mcp/ \
      --bearer-token-env-var MEOW_PLATFORM_API_KEY
    
    codex mcp list

    The equivalent user configuration in ~/.codex/config.toml is:

    [mcp_servers.meow]
    url = "https://meowmeowscratch.com/mcp/"
    bearer_token_env_var = "MEOW_PLATFORM_API_KEY"

    Restart Codex or the Codex IDE extension after changing the configuration. For a project-specific setup, use the same table in a trusted project’s .codex/config.toml.

    Standalone Claude Code configuration

    Place this in the project’s .mcp.json:

    {
      "mcpServers": {
        "meow": {
          "type": "http",
          "url": "https://meowmeowscratch.com/mcp/",
          "headers": {
            "Authorization": "Bearer ${MEOW_PLATFORM_API_KEY}"
          }
        }
      }
    }

    Launch Claude Code from the shell where the variable is set, approve the project server and run /mcp. The file contains a variable reference—not the secret—so it can be reviewed without exposing the token.

    Verify the connection without changing anything

    Begin with an explicitly read-only prompt:

    Use the Meow tools for a read-only connection check.
    
    1. Call connection_status.
    2. Call get_limits.
    3. List my apps.
    4. Summarise the result.
    
    Do not create, update, delete, publish, revoke or reconfigure anything.

    A successful check confirms that the MCP Authorization header contains a platform token without returning the token itself. The limits result shows current enforced capacity, and the app list proves the agent can perform authenticated discovery.

    If the account has no apps, an empty list is still a valid result. Do not create a throwaway resource merely to prove that discovery works.

    A safe first agent task

    Separate discovery and planning from mutation. This prompt produces useful work without changing the account:

    Inspect my Meow apps, endpoints, collection fields and dashboards.
    
    Report:
    - the existing structure;
    - any duplicate or confusing slugs;
    - remaining capacity relevant to a Weather Station project; and
    - a proposed private app, endpoint and field design.
    
    Do not make changes. Wait for my approval after presenting the plan.

    After reviewing the plan, authorise one bounded change at a time. A good creation prompt names the resource, requires it to remain private and asks the agent to read it back:

    Create only the private app described in the approved plan.
    Do not create its endpoints yet.
    Read the app back, report its slug and stop.

    Creating a Meow resource is an immediate account change. The public resource MCP does not have a WordPress-style draft/publish stage. “Propose only” and “do not make changes” therefore need to be explicit when you want planning rather than execution.

    Recommended tool workflow

    1. Call connection_status.
    2. Call get_limits before provisioning resources.
    3. List apps and endpoints before creating or changing them.
    4. Inspect endpoint and field schemas before writing data.
    5. Resolve record, field, widget, webhook and key UUIDs through discovery; never guess them.
    6. Require immediate human confirmation for destructive or sensitive operations.
    7. Call the narrowest applicable tool.
    8. Read the resource back and verify the result.
    9. Return the consumer URL and relevant identifiers.

    What the tools can cover

    FamilyTypical operations
    DiscoveryConnection status, enforced limits, field types, apps, endpoints, records and dashboards
    StructureCreate, update and delete apps, endpoints and collection fields
    DataCreate one record or a batch; inspect, update, delete, aggregate and export records
    IntegrationsStatic payloads, proxies, webhooks, response encryption and request logs
    Control panelsCreate widgets, read configured state and write through widget UUIDs
    Consumer viewsRead public endpoints and records or open shared dashboards

    Actions that need special care

    ActionWhy it mattersSafe expectation
    Delete a resource or recordData or structure may be difficult to recoverShow the exact target and request immediate confirmation.
    Revoke a keyA running device or integration may stop workingIdentify the key by discovered UUID and explain affected clients.
    Change encryptionClients may lose the ability to read responsesExplain the migration and key-handling consequences first.
    Make an app or endpoint publicData may become anonymously readableKeep it private unless public access is explicitly approved.
    Write through a dashboardA bound device may react immediatelyConfirm the dashboard, widget UUID and intended value.

    The hosted MCP service does not insert its own human approval gate. Configure the client to ask for sensitive actions, and write prompts that define the allowed scope.

    Troubleshooting

    SymptomWhat to check
    401 or missing toolsConfirm MEOW_PLATFORM_API_KEY was exported before launching the client and contains an active platform token.
    Redirect or negotiation failureUse the exact URL https://meowmeowscratch.com/mcp/, including the trailing slash.
    403The requested route may be outside Meow resource access. Use the web app for account, token-management and billing operations.
    429The service allows 60 tool calls per token per minute. Stop polling and wait for the one-minute window.
    Codex shows old configurationRefresh or reinstall the plugin, then start a new thread and inspect /mcp.
    Claude Code shows old configurationRun /reload-plugins or start a new session.
    Claude reports a missing variableExport the variable before launching Claude Code, then inspect claude mcp list.
    Plugin installed but MCP absentCheck client or workspace policy, then inspect /mcp and client debug output.

    Security checklist

    • The MCP URL uses HTTPS and ends with /mcp/.
    • The token comes from MEOW_PLATFORM_API_KEY, not a file or URL.
    • No token appears in source code, prompts, screenshots or logs.
    • The installed plugin came from the official repository and its updates are reviewed.
    • The first task is read-only discovery.
    • New apps and endpoints remain private by default.
    • Deletes, key revocation, encryption changes and sensitive writes require immediate approval.
    • The agent verifies every mutation by reading the affected resource back.
    • The workflow does not poll unchanged resources or exceed the 60-calls-per-minute limit.

    Where to go next

    Once read-only discovery works, use the agent to inspect an existing project and propose a small, private change. Keep the first mutation narrow, verify it immediately and expand the workflow only after the approval boundary behaves as expected.

    See the official Meow MCP documentation for the current connection reference and the Meow Agent Tools repository for plugin source, manifests and the shared workflow.

  • Build Your First Meow Meow Scratch Dashboard

    Turn the temperature records from the beginner API project into a simple control panel that always shows the latest reading.

    This guide uses the Weather Station app from the first two tutorials. You will create a dashboard, bind a display widget to the temperature field and prove the connection by sending a fresh value.

    What you will build

    Python or curl
          │
          │ sends {"temperature": 23.1}
          ▼
    Weather Station
    readings collection
          │
          │ latest record
          ▼
    Weather Station dashboard
    Temperature (°C): 23.1

    The result is deliberately small: one useful value with a clear label and unit. Once that path works, the same pattern can display doorbell events, plant moisture, room conditions or any other collection field.

    Before you start

    • A Meow Meow Scratch account
    • An app named Weather Station with slug weather-station
    • A Collection endpoint named Readings with slug readings
    • A required Number field with key temperature
    • At least one temperature record

    If any of those pieces are missing, complete What Is an API? A Practical Beginner’s Guide. If you want to send the fresh reading with Python, also complete Install the Meow SDK and Make Your First Request.

    Dashboard or control panel?

    The SDK calls this resource a dashboard. The product documentation also describes it as a control panel. Both names refer to the same idea: a page of widgets bound to values in your endpoints.

    It is important to choose the widget according to the endpoint type:

    EndpointDashboard behaviorGood use
    CollectionDisplay-only widgets read fields from the latest recordTemperature, sensor readings, events and status reports
    Static payloadInteractive widgets can read and write bound valuesSettings, switches, target values and remote configuration
    Proxy / integrationWidgets are not supportedUse its consumer response directly instead

    Weather Station uses a collection, so its temperature widget will show the newest record. It will not edit that record.

    1. Confirm the source data

    In the web app, open Apps → Weather Station → Readings. Check the collection’s records and find the most recent temperature.

    If you followed the earlier examples, the newest value may be 22.5. Write down whatever your actual latest value is; you will compare it with the dashboard.

    2. Create the dashboard

    1. Open the Dashboards or Control Panels area in the web app.
    2. Choose New Dashboard.
    3. Set the name to Weather Station.
    4. Set the slug to weather-station-panel.
    5. Use the description Latest readings from the Weather Station tutorial.
    6. Save the dashboard and keep it private for now.

    The slug is the stable machine-readable name used by the SDK and API. If weather-station-panel already exists, open that dashboard instead of creating a duplicate.

    3. Add the temperature widget

    Inside the new dashboard, choose Add Widget and use these settings:

    SettingValue
    AppWeather Station / weather-station
    EndpointReadings / readings
    Key path or fieldtemperature
    Widget typeDisplay
    LabelTemperature (°C)

    Save the widget. The displayed number should match the latest record you checked in the previous step.

    Why put °C in the label? A number without a unit is ambiguous. 23.1 could mean Celsius, Fahrenheit, humidity or voltage. The label should make the value understandable without requiring the reader to inspect the endpoint schema.

    4. Send a fresh reading

    Activate the virtual environment from the SDK guide and make sure MEOW_PLATFORM_API_KEY is set in the current terminal. Then run this short Python program:

    import os
    
    from meow_sdk import Meow
    
    
    api = Meow(
        api_key=os.environ["MEOW_PLATFORM_API_KEY"],
        timeout=30,
    )
    
    record = api.send(
        "weather-station",
        "readings",
        {"temperature": 23.1},
    )
    
    print("Created:", record["uuid"])
    print("Temperature:", record["data"]["temperature"], "°C")

    A successful run prints the new record’s UUID and 23.1 °C. Return to the dashboard and refresh it. The display widget should now show 23.1 because that is the latest collection record.

    This is the key verification step. It proves that the widget is bound to live endpoint data rather than a number typed into the dashboard.

    Create the same dashboard with Python

    The web app is the clearest path for a first dashboard. If you prefer reproducible setup, the SDK can create the same resources. Use this instead of steps 2 and 3, not after them:

    import json
    import os
    
    from meow_sdk import Meow
    
    
    api = Meow(
        api_key=os.environ["MEOW_PLATFORM_API_KEY"],
        timeout=30,
    )
    
    dashboard = api.create_dashboard(
        "Weather Station",
        "weather-station-panel",
        description="Latest readings from the Weather Station tutorial.",
    )
    
    widget = api.create_dashboard_widget(
        "weather-station-panel",
        "weather-station",
        "readings",
        "temperature",
        "display",
        "Temperature (°C)",
    )
    
    print("Dashboard:", dashboard["slug"])
    print("Widget:", widget["uuid"])
    
    state = api.dashboard_state("weather-station-panel")
    print(json.dumps(state, indent=2))

    The two slug arguments after the dashboard identify the app and endpoint. The temperature key path selects the field. The final two values choose a display widget and its human-readable label.

    Current value versus history

    A collection display widget answers: What is the latest value? It is not a historical chart and does not have a time-range selector.

    • Use the dashboard when you need a quick current-state view.
    • Use collection records when you need the full sequence and timestamps.
    • Use API filters when you need records matching a condition.
    • Use aggregates for values such as average, minimum, maximum, sum or count.
    • Use CSV export when you want to analyse or chart the history elsewhere.

    This distinction prevents a common design mistake: treating a latest-value control panel as if it were a time-series analytics tool.

    Troubleshooting missing or stale values

    What you seeLikely causeWhat to check
    No valueThe collection has no recordsOpen Readings and create one valid temperature record.
    Widget cannot be createdThe app, endpoint or key path is wrongUse the exact slugs weather-station, readings and key temperature.
    Old temperature remainsThe new request failed or the page has not refreshedCheck the Python output, endpoint records and request logs, then refresh the dashboard.
    Wrong field is shownThe widget is bound to another key pathEdit the widget and select temperature.
    A control cannot change the valueCollection widgets are display-onlyUse a static payload endpoint for an interactive setting.
    Widget option is unavailableThe endpoint is a proxyBind widgets to a collection or static payload instead.
    AuthError in PythonThe platform token is missing or invalidSet MEOW_PLATFORM_API_KEY in the same terminal without printing it.

    When to use interactive widgets

    For remote control, create a static payload such as:

    {
      "target_temperature": 22,
      "fan_enabled": false,
      "display": {
        "brightness": 70
      }
    }

    You can then bind number, toggle or slider widgets to target_temperature, fan_enabled or the nested key path display.brightness. Changing the dashboard updates the same JSON that a Raspberry Pi or other client can poll.

    Other supported widget types include color, text and select. Choose the smallest control that matches the underlying value, and use bounds or choices where the widget configuration allows them.

    Share carefully

    Keep the dashboard private while building. If you later enable sharing, treat the share link like access to the panel: anyone who receives it may be able to view its current data until access is disabled or expires.

    • Do not display tokens, private identifiers or sensitive sensor data.
    • Open the share link in a private browser window to confirm exactly what another person can see.
    • Prefer an expiry when the sharing interface offers one.
    • Disable sharing when it is no longer needed.

    What to build next

    You now have the complete software path: create an API, send data with Python and show its latest value on a dashboard. The next step is to replace the fixed 23.1 with a real sensor reading from a Raspberry Pi.

    For more detail, see the web app and control-panel documentation, the SDK documentation and the open-source meow-sdk repository.

  • Install the Meow SDK and Make Your First Request

    Install the Meow SDK in an isolated Python environment, connect it safely to your account and send a temperature reading with a few lines of code.

    This guide continues the Weather Station example from What Is an API? A Practical Beginner’s Guide. You will replace the raw curl command with a small Python program, then read the record back and handle the most common errors.

    Tested environment

    These installation steps were checked with meow-sdk 0.7.0 on Python 3.8.20, 3.11.14 and 3.13.5. The SDK requires Python 3.8 or newer. The package, imports, command-line tool, upgrade and uninstall paths were verified on 25 July 2026.

    What you need

    • Python 3.8 or newer
    • A terminal
    • A Meow Meow Scratch account
    • A Weather Station app with a readings collection and required Number field named temperature
    • A platform token for the account-wide learning exercise

    If you have not created the Weather Station resources, complete the beginner API guide first. The names and slugs in this article assume that setup.

    1. Check your Python version

    Open a terminal and run:

    python3 --version

    You should see Python 3.8 or newer, for example:

    Python 3.11.14

    On Windows, the command may be py --version. If the command is not found or reports an older version, install a current Python 3 release before continuing.

    2. Create a project and virtual environment

    A virtual environment gives this project its own Python packages. It prevents one project’s dependencies from unexpectedly changing another project.

    mkdir meow-sdk-quickstart
    cd meow-sdk-quickstart
    python3 -m venv .venv

    Activate it on macOS, Linux, Git Bash or WSL:

    source .venv/bin/activate

    For Windows PowerShell, use:

    .venv\Scripts\Activate.ps1

    Your prompt will usually begin with (.venv) after activation. Confirm that the terminal is using the environment’s interpreter:

    python --version
    python -m pip --version

    From this point onward, use python rather than python3. The activated virtual environment supplies the correct command.

    3. Install the Meow SDK

    Install the current release from PyPI:

    python -m pip install meow-sdk

    Using python -m pip is deliberate: it runs pip through the same Python interpreter that will run your program.

    Verify the installed version and import:

    python -c "import importlib.metadata as m; from meow_sdk import Meow; print(m.version('meow-sdk'))"

    At the time this guide was tested, the command printed:

    0.7.0

    The exact version may be newer when you follow this guide. Check the meow-sdk package page on PyPI for the current release.

    4. Choose the right credential

    CredentialScopeUse it for
    Platform tokenResources across your accountSDK, CLI and account-wide automation
    App API keyOne app, with separate Read and Write scopesRaspberry Pis, deployed devices and single-app integrations
    No keyPublic data onlyReading an endpoint that its owner deliberately made public

    Use a platform token for this learning exercise because the SDK can work with account-level resources. Create one under Account → Platform Tokens.

    On a deployed device, use an app API key whenever possible. If that device is lost or compromised, the key cannot reach unrelated apps. Grant only the Read and Write scopes the device actually needs.

    Do not put a real token in the Python file. Do not commit one to Git or paste one into chat, an issue or a screenshot.

    For a temporary terminal session on macOS, Linux, Git Bash or WSL, enter the token without placing it in your shell history:

    read -s MEOW_PLATFORM_API_KEY
    export MEOW_PLATFORM_API_KEY

    Paste the token when the terminal waits for input, press Enter, then run the export command. Nothing appears while you paste because -s disables echo. The variable disappears when you close that terminal.

    The current tools use MEOW_PLATFORM_API_KEY for account-wide access and MEOW_APP_API_KEY for one app. Do not use the ambiguous legacy name MEOW_API_KEY.

    5. Send a reading and read it back

    Create a file named first_request.py with this code:

    import os
    
    from meow_sdk import AuthError, Meow, MeowError, NotFoundError
    
    
    api_key = os.environ.get("MEOW_PLATFORM_API_KEY")
    if not api_key:
        raise SystemExit(
            "MEOW_PLATFORM_API_KEY is not set. "
            "Set it in your terminal, then run this program again."
        )
    
    api = Meow(api_key=api_key, timeout=30)
    
    try:
        created = api.send(
            "weather-station",
            "readings",
            {"temperature": 22.5},
        )
        print("Created record:", created["uuid"])
        print("Created data:", created["data"])
    
        page = api.records(
            "weather-station",
            "readings",
            limit=5,
        )
        print("Total records:", page["count"])
        print("Records returned:", len(page["results"]))
    
    except AuthError:
        print("Authentication failed. Check your platform token.")
    except NotFoundError:
        print("Check the weather-station and readings slugs.")
    except MeowError as error:
        print(f"API error {error.status_code}: {error}")

    Run it while the virtual environment is active:

    python first_request.py

    A successful run will resemble this:

    Created record: 2d8e…your-record-uuid…91ab
    Created data: {'temperature': 22.5}
    Total records: 3
    Records returned: 3

    Your UUID and counts will be different. api.send() creates one record and returns it. api.records() reads a page of records through the authenticated management API. Its response includes count for the total and results for the records in the current page.

    What each important line does

    CodePurpose
    os.environ.get(...)Reads the token from the current process environment instead of source code.
    Meow(api_key=..., timeout=30)Creates the API client, adds Bearer authentication and limits how long a request may wait.
    api.send(...)POSTs a new record to the selected collection.
    created["uuid"]Reads the unique identifier returned for the new record.
    api.records(...)GETs a paginated list through the authenticated management API.
    except AuthErrorHandles missing, invalid or disallowed authentication separately.

    Public reads use a username

    A deliberately public endpoint can be read without a key. Create a client with the owner’s username and call get():

    from meow_sdk import Meow
    
    api = Meow(username="YOUR_USERNAME")
    data = api.get("YOUR_PUBLIC_APP", "YOUR_PUBLIC_ENDPOINT")
    print(data)

    Replace all three placeholders with a real public resource. This is different from records(): get() uses the stable consumer URL and requires a username, while records() uses authentication and can read private collections.

    Troubleshooting

    ProblemLikely causeFix
    ModuleNotFoundError: No module named 'meow_sdk'The SDK was installed into a different Python environment.Activate .venv, then run python -m pip install meow-sdk again.
    MEOW_PLATFORM_API_KEY is not setThe environment variable is missing from this terminal.Enter and export the token, then rerun the program in the same terminal.
    AuthErrorThe token is missing, invalid or not permitted.Create or recopy the correct credential. Never print the token while debugging.
    NotFoundErrorAn app or endpoint slug does not exist for this account.Compare the web-app slugs with the two strings passed to the SDK.
    ValidationErrorThe record does not match the endpoint schema.Check required fields, field names and value types.
    RateLimitErrorThe client is sending requests too quickly.Slow down and retry with increasing delays.
    meow: command not foundThe virtual environment is inactive or its scripts directory is not on PATH.Activate .venv and run meow --help again.

    The installed package provides typed AuthError, NotFoundError, ValidationError, RateLimitError and general MeowError exceptions. Catching specific exceptions lets a program explain what the reader can actually fix.

    The SDK also installed a CLI

    The same package installs a meow command. Confirm it is available:

    meow --help

    The CLI can send and read records, manage apps and endpoints, work with dashboards and inspect limits. The Python client is the focus here because it gives you a foundation for scripts and devices; see the CLI reference when you want terminal-first automation.

    Upgrade, leave or remove the environment

    Upgrade the SDK inside the active environment with:

    python -m pip install --upgrade meow-sdk

    Leave the virtual environment without deleting it:

    deactivate

    If you no longer want the package in that environment, activate it and run:

    python -m pip uninstall meow-sdk

    What to build next

    You now have an isolated Python project, a safely configured SDK client and a complete write-and-read loop. The natural next step is to display these readings in a dashboard, then replace the fixed value with data from a sensor or another program.

    Keep the Meow Meow Scratch SDK documentation and complete SDK API reference nearby. The package source and issue tracker are in the meow-sdk GitHub repository.

  • What Is an API? A Practical Beginner’s Guide

    An API is how one program asks another program for data or tells it to do something. In this guide, you will see what is inside that conversation and make a real API request—without needing to write a program first.

    By the end, you will have created a private temperature API, sent it a reading and read the result back. You will also know what URLs, methods, headers, JSON and status codes are doing in the commands you run.

    The shortest useful definition

    API stands for application programming interface. The name sounds abstract, but the basic idea is simple: an API is a defined way for software systems to communicate.

    Imagine a weather display that needs the latest temperature. The display does not need access to the weather station’s database or source code. It sends a request to an agreed address, and the API returns a response in an agreed format.

    • Request: “Give me the latest readings.”
    • Endpoint: the API address that receives the request.
    • Response: the status and data returned by the API.

    That request–response loop is the foundation of weather apps, payment systems, smart-home devices, dashboards and most modern web services.

    YOUR CLIENT                         API
    (terminal, app or device)           (the service)
    
          POST /readings/
          headers + JSON
                 ──────────────────────►
                                        authenticate
                                        validate
                                        create record
                 ◄──────────────────────
          201 Created
          status + JSON

    A useful analogy—and where it stops

    An API is often compared with ordering at a counter. You choose from a defined menu, make a specific request and receive either what you ordered or an explanation of the problem. You do not walk into the kitchen and operate the equipment yourself. In the same way, an API exposes specific operations without giving a client direct access to the service’s database or internal code.

    The analogy stops there. Software does not infer what you meant, overlook a spelling mistake or negotiate an alternative. The URL, method, credentials and data must follow the API’s contract precisely. That strictness is what lets many different clients receive predictable results.

    The five parts you can see

    An HTTP API request usually has five parts. You do not need to memorise them yet; just learn to recognise them.

    PartWhat it meansExample
    URLWhere the request is sent/weather-station/readings/
    MethodWhat kind of action you wantGET or POST
    HeadersExtra context, including authentication and content typeAuthorization: Bearer …
    BodyThe data sent with a write request{"temperature":22.5}
    StatusThe numeric result returned by the API201 Created

    The request contains the first four parts. The status is part of the response. A response will often include a body as well, usually formatted as JSON.

    Methods are verbs

    The HTTP method tells the API what sort of operation you intend to perform. These are the methods you will see most often:

    MethodPurposePlain-English example
    GETRead dataShow me the temperature readings.
    POSTCreate dataAdd this new temperature reading.
    PUTReplace a resourceReplace this settings document with the supplied version.
    PATCHUpdate part of somethingChange this reading to 23.
    DELETERemove somethingDelete this reading.

    The URL identifies a resource; the method identifies the action. The same record URL can therefore support a GET to read it, a PATCH to change it and a DELETE to remove it.

    JSON is the message format

    APIs need a predictable way to represent data. Meow Meow Scratch®, like many web APIs, uses JSON. A temperature reading looks like this:

    {
      "data": {
        "temperature": 22.5
      }
    }

    JSON uses named keys and values. Here, data contains an object, and that object has a temperature value of 22.5. Quotes matter, braces must match and numbers are not placed inside quotes.

    Build your first API

    This exercise creates a private Weather Station app with a Readings collection. Each record will contain one numeric temperature. No Raspberry Pi or other hardware is required.

    Before you start

    • A Meow Meow Scratch account
    • A terminal with curl
    • About 10 minutes

    The commands below use macOS, Linux, Git Bash or WSL shell syntax. Git Bash is the simplest way to run them unchanged on Windows. PowerShell uses different syntax for environment variables and line continuation.

    1. Create the app and collection

    Sign in to the web app, then create the following resources. Enter the slugs exactly as shown because they become part of the API URL.

    1. Open Apps → New App. Set the name to Weather Station and the slug to weather-station.
    2. Open the new app and choose New Endpoint. Set the name to Readings, the slug to readings and the type to Collection.
    3. Open the endpoint and choose Add Field. Use the label Temperature, key temperature and type Number. Enable Required.

    Keep the app private. Private is the safe default for learning because every request must prove that it has permission.

    2. Create a restricted API key

    Inside Weather Station, open API Keys → New API Key. Name it API tutorial, enable both Read and Write, then copy the value when it appears. The complete value is shown once.

    Use an app API key here—not a platform token. An app key is restricted to one app, so it gives this exercise only the access it needs.

    Treat an API key like a password. Do not paste a real token into source code, chat, screenshots or a public repository.

    In your terminal, set three reusable values. Replace both placeholders, but keep the quotation marks:

    export MEOW_APP_API_KEY="YOUR_APP_API_KEY"
    export MEOW_USERNAME="YOUR_USERNAME"
    export MEOW_API="https://meowmeowscratch.com/api"

    Environment variables save you from repeating the key and username in every command. They last for the current terminal session.

    3. Create a temperature reading with POST

    Before running the next command, predict what it should do: the method is POST, the URL ends in records/, and the JSON body contains one temperature. It should create one record.

    curl -i -X POST \
      "$MEOW_API/apps/weather-station/endpoints/readings/records/" \
      -H "Authorization: Bearer $MEOW_APP_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{"data":{"temperature":22.5}}'

    A successful response starts with 201 Created. Its JSON body will have this shape; your UUID and timestamps will be different:

    HTTP/... 201 Created
    
    {
      "uuid": "…",
      "data": {
        "temperature": 22.5
      },
      "created_at": "…",
      "updated_at": "…"
    }

    201 means the API accepted the request and created a new resource. The UUID is the stable identifier for this particular record.

    4. Read the collection with GET

    Now use the collection’s consumer URL to read the record back. GET is curl’s default method, so the command does not need -X GET.

    curl -i \
      "$MEOW_API/v1/$MEOW_USERNAME/weather-station/readings/" \
      -H "Authorization: Bearer $MEOW_APP_API_KEY"

    A successful response starts with 200 OK and includes both the collection schema and its records:

    HTTP/... 200 OK
    
    {
      "count": 1,
      "fields": [
        {
          "name": "temperature",
          "label": "Temperature",
          "field_type": "number"
        }
      ],
      "records": [
        {
          "uuid": "…",
          "data": {
            "temperature": 22.5
          },
          "created_at": "…"
        }
      ]
    }

    If your collection already contains other records, count will be higher and the records array will be longer. That is expected.

    Read the curl command in plain English

    PartMeaning
    curlRun the command-line HTTP client.
    -iShow response headers and the status as well as the JSON body.
    -X POSTUse the POST method.
    -HAdd a header to the request.
    Authorization: Bearer …Present your API key so the private endpoint can check your access.
    Content-Type: application/jsonTell the API that the request body is JSON.
    -dSend the JSON that follows as the request body.
    \Continue the same shell command on the next line.

    Make the API reject bad data

    An API is useful not only because it accepts data, but because it applies consistent rules. You defined temperature as a Number. Send the word "warm" instead:

    curl -i -X POST \
      "$MEOW_API/apps/weather-station/endpoints/readings/records/" \
      -H "Authorization: Bearer $MEOW_APP_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{"data":{"temperature":"warm"}}'

    You should receive a 400 validation response. That is a successful demonstration of the schema doing its job: invalid data was rejected before it could enter the collection.

    How to interpret status codes

    Status codes are compact summaries. The first digit gives you the broad result:

    • 2xx: the request succeeded.
    • 4xx: something about the request, credentials or target needs attention.
    • 5xx: the server could not complete an otherwise valid request.
    StatusMeaningFirst thing to check
    200 OKA read or update succeededInspect the returned JSON.
    201 CreatedA new resource was createdSave the returned UUID if you need the record later.
    204 No ContentA delete succeededAn empty body is expected.
    400 Bad RequestThe input is invalidCheck the JSON, field names and value types.
    401 UnauthorizedAuthentication is missing or invalidCheck that the key was copied correctly and the Bearer header is present.
    403 ForbiddenThe credential is known but not permittedCheck the key’s Read or Write scope and app.
    404 Not FoundThe resource does not exist at that URLCheck the username, slugs and path.
    429 Too Many RequestsThe client is being rate limitedSlow down and retry with backoff.

    Common mistakes

    • Missing the trailing slash: Meow API routes are slash-terminated. Use /records/, not /records, to avoid a redirect—especially with POST, PATCH and DELETE.
    • Using the wrong key: an app API key works only with its app and its enabled scopes. Account-wide automation normally uses a platform token.
    • Putting a number in quotes: 22.5 is a JSON number; "22.5" is text.
    • Changing the example slugs: if you choose different slugs in the web app, you must also change them in every URL.
    • Copying spaces into environment variables: write NAME="value", with no spaces around the equals sign.
    • Hiding the useful error: keep -i while learning so you can see the HTTP status and headers.

    API, website and database: what is the difference?

    A website is primarily an interface for people. A database stores structured information. An API is an interface that software can use. A single product often has all three: you configure a collection in a website, its records are stored in a database, and a device reads or writes them through an API.

    The API creates a controlled boundary. A client can do only what the documented endpoints, credentials and validation rules allow; it does not receive unrestricted access to the database underneath.

    Try three small experiments

    1. Send another POST with the temperature set to 18.4, then GET the collection again. Confirm that the count increases.
    2. Add ?temperature__gte=20 to the end of the GET URL. Predict which record will remain before running the command.
    3. Open Request Logs in the Readings endpoint. Find your GET request and compare its method, status and response time with what curl displayed.

    Changing one thing at a time is one of the fastest ways to learn an API. Make a prediction, run the request, then use the status and response body to explain the result.

    What you now know

    You have defined a schema, used a restricted credential, sent JSON with POST, interpreted a 201 response, read records with GET and inspected a deliberate 400 validation error. Those same ideas carry into Python scripts, Raspberry Pi sensors, dashboards and AI tools.

    Keep the Meow Meow Scratch REST API reference nearby when you build. When you are ready to stop writing raw curl commands, the open-source Meow SDK provides a Python client and command-line interface for the same resources.