🥞
Glif Docs/Guide
  • Getting Started
    • 👋What is Glif?
    • 💡What can I do with a glif?
      • 🏃Run a glif
      • 🔌Build a glif
      • 🔀Remix a glif
      • 🗣️Comment on a glif
      • 🔳Embed a glif
    • ⚒️How do I build a glif?
      • 📽️Video tutorial: Building a simple image generator
      • 🟰Using variables
    • ⚙️Profile Settings
    • 🪙Credits and Payments
    • ❓FAQs
  • Blocks
    • 🙋Inputs
      • ✍️Text Input Block
      • 🖼️Image Input Block
      • 📋Multipick Block
    • 🪄Generators
      • 📃Text Block
      • 🖼️Image Block
      • ➡️Image to Text Block
        • Florence2Sam2Segmenter
    • 🧰Tools
      • 🔀Text Combiner Block
      • 🔬JSON Extractor Block
      • 🎬Videokit Tools
    • 💅Styling
      • 🎨HTML Block
      • 🖼️Canvas Block
    • 🧑‍🔬Advanced/Experimental
      • 🎙️Audio Input Block
      • ↔️Glif Block
      • 🌐Web Fetcher Block
      • 🔊Audio Spell
      • 🧱ComfyUI Block
      • 📡Audio to Text Block
      • 🎥Video Input Block
      • 🔧JSON Repair Block
  • Apps
    • 🎨Glif It! Browser Extension
  • Glif University
    • 🎥Video Tutorials
      • 🐲How To: D&D Character Sheet Generator
      • 🧠How To: Expanding Brain Meme Generator
      • 🦑How To: Occult Memelord Generator
      • 🥸How To: InstantID Portrait Restyle Glif
      • 🕺How To: Style and Pose a Character with InstantID + Controlnet
      • 😱How To: Create a Simple Cartoon Portrait Animation Glif (LivePortrait + Custom Blocks)
      • 👗How to Create a Clothing Restyler App (IP Adapter, ControlNet + GPT Vision)
      • 🤡How to Create a 4+ Panel Storyboard/Comic (Flux Schnell)
      • 🎂How to Create a Recipe Generator with Accompanying Pictures
      • How to Use JasperAI Depth Controlnet on Flux Dev
      • 🦸‍♂️How to Make a Consistent Comic Panel Generator
    • 🧑‍🏫Prompt Engineering 101
    • 🖼️ControlNet
    • 📚AI Glossary
  • API - for Developers
    • ⚡Running glifs via the API
    • 🤖Using AI Assistants to build with the Glif API
    • 📙Reading & writing data via the API
    • 🗾Glif Graph JSON Schema
    • 📫Embed player & custom webpages
    • 📫Sample code
    • ❓What can I make with the Glif API?
      • Browser Extensions
      • Discord Bots
      • Games
      • Social Media Bots
      • Experimental Projects
  • Policies
    • 👨‍👩‍👧‍👦Community Guidelines
  • Programs
    • 🖼️Loradex Trainer Program
  • Community Resources
    • 🧑‍🤝‍🧑Resources Created by Glif Community Members
  • Contact Us
    • 📣Send us your feedback
    • 🚔Information for law enforcement
Powered by GitBook
On this page
  1. API - for Developers

Glif Graph JSON Schema

PreviousReading & writing data via the APINextEmbed player & custom webpages

Last updated 21 days ago

Glif API is in beta and subject to change.

Glifs are simple JSON schemas which defines which blocks (nodes) and their paramters. When you're , you can use the following JSON schema to help create valid glifs.

This is especially useful if you're - just paste the JSONSchema and tell the LLM to adhere to it or build you an API endpoint that produces things.

Here is a WIP prompt usable with the JSONSchema to produce valid glifs:

You are working with glifs, which are no-code AI workflows. Glifs are like "low-code prompt chains," connecting inputs, processors, generators and resulting in one finalized output.

Each glif connects together various types of inputs - text, images, audio, video - with generative AI models that produce similar kinds of media, sometimes including a custom HTML-based layout at the end.

Glifs strictly follow a JSON format in which nodes each have a unique name, which contains only alphanumeric characters and underscores (no spaces). Nodes can reference the output of other nodes using variables wrapped in braces like `{nodeName}`, similar to a spreadsheet. Importantly, variables can only reference nodes that actually exist.

Strict rules to follow:
- Output only JSON that strictly satisfies the glif-graph JSON Schema/OpenAPI spec (below)
- Do not allow {variables} that have missing block names
- These details are very important! Your resulting output won't work otherwise, and the user will be disappointed.
- Each node must have a unique name with no spaces or special characters. Alphanumeric plus underscores only.
- Inputs should only be added if they are actually used by other nodes.
- Try not to add too many inputs. Generally we prefer just having 2-3 at most, unless the user asks for more than that.
- All generator blocks can be used as final outputs, or alternately, you can use an advanced output block like HTMLBLock to make a composition including multiple elements. Users genreally like this.
- Don't use ComfyBlock, it is too advanced for you!
- Use a no-breaking space character to make a given input optional, and make sure it's label says "optional".

You can also see this on glif.app using "Edit Graph JSON" on any glif

Here's an example of a glif graph JSON - the data field in an /api/glifs API response:

🗾
creating a glif via the API
https://glif.app/api/graphJsonSchema
Using AI assistants to build with the Glif API
https://glif.app/api/glifs?id=cma5ypuh10000jk0474ais5f0