{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/juzpost/json-schema/juzpost-me-schema.json",
  "title": "Me",
  "description": "Everything an agent needs to know before acting, in one call.",
  "x-generated": "2026-11-08",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/juzpost-openapi.json#/components/schemas/Me",
  "type": "object",
  "required": [
    "user",
    "credential",
    "workspace",
    "plan",
    "billing",
    "entitlements",
    "quotas",
    "limits",
    "blocked"
  ],
  "properties": {
    "user": {
      "type": "object",
      "description": "The user the credential was minted for.",
      "required": [
        "id",
        "email"
      ],
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "description": "The user's id."
        },
        "email": {
          "type": [
            "string",
            "null"
          ],
          "description": "The user's email address, or null if the account has none on record."
        }
      }
    },
    "credential": {
      "type": "object",
      "description": "The credential used for this request. Never includes the secret.",
      "required": [
        "type",
        "scopes",
        "expiresAt"
      ],
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "api_key",
            "oauth"
          ],
          "description": "`api_key` for a dashboard-issued key, `oauth` for an AI connector grant."
        },
        "scopes": {
          "type": "array",
          "description": "Scopes granted. API keys hold all four.",
          "items": {
            "type": "string",
            "enum": [
              "read",
              "create",
              "edit",
              "admin"
            ]
          }
        },
        "expiresAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "When an OAuth access token expires. Null for API keys."
        }
      }
    },
    "workspace": {
      "allOf": [
        {
          "$ref": "#/$defs/Workspace"
        },
        {
          "type": "object",
          "required": [
            "slug",
            "role"
          ],
          "properties": {
            "slug": {
              "type": "string",
              "description": "URL slug of the workspace."
            },
            "role": {
              "type": "string",
              "description": "The calling user's role in the workspace, such as `owner`."
            }
          }
        }
      ],
      "description": "The workspace this credential is scoped to. Everything you can read or write lives inside it."
    },
    "plan": {
      "type": "object",
      "description": "The plan in force. An unknown or lapsed subscription resolves to `none`.",
      "required": [
        "id",
        "name",
        "trialActive"
      ],
      "properties": {
        "id": {
          "type": "string",
          "enum": [
            "none",
            "solo",
            "growth",
            "pro"
          ],
          "description": "Plan id. `none` means no active paid plan, in which case most operations return `402`."
        },
        "name": {
          "type": "string",
          "description": "Display name of the plan."
        },
        "trialActive": {
          "type": "boolean",
          "description": "Whether the subscription is in its trial period."
        }
      }
    },
    "billing": {
      "oneOf": [
        {
          "$ref": "#/$defs/Billing"
        },
        {
          "type": "null"
        }
      ],
      "description": "Subscription state, or null when the workspace has never subscribed."
    },
    "entitlements": {
      "$ref": "#/$defs/Entitlements"
    },
    "quotas": {
      "type": "object",
      "description": "Usage against the caps. `subscription` is one pool shared by every workspace the\nplan owner has; `workspace` is this workspace alone.\n",
      "required": [
        "subscription",
        "workspace"
      ],
      "properties": {
        "subscription": {
          "type": "object",
          "required": [
            "ownedBy",
            "accounts",
            "queuedPosts"
          ],
          "properties": {
            "ownedBy": {
              "type": "string",
              "enum": [
                "you",
                "workspace owner"
              ],
              "description": "Whose subscription the plan and these counts belong to."
            },
            "accounts": {
              "type": "object",
              "required": [
                "used",
                "max"
              ],
              "properties": {
                "used": {
                  "type": "integer",
                  "description": "Social accounts connected across every workspace the owner has."
                },
                "max": {
                  "type": "integer",
                  "description": "Account slots granted to the subscription."
                }
              }
            },
            "queuedPosts": {
              "type": "object",
              "required": [
                "used",
                "max"
              ],
              "properties": {
                "used": {
                  "type": "integer",
                  "description": "Posts scheduled and not yet published, across every workspace the owner has."
                },
                "max": {
                  "type": "integer",
                  "description": "Maximum scheduled posts the plan allows at once."
                }
              }
            }
          }
        },
        "workspace": {
          "type": "object",
          "required": [
            "accounts",
            "storage"
          ],
          "properties": {
            "accounts": {
              "type": "integer",
              "description": "Social accounts connected in this workspace."
            },
            "storage": {
              "type": "object",
              "required": [
                "usedBytes",
                "quotaBytes"
              ],
              "properties": {
                "usedBytes": {
                  "type": "integer",
                  "description": "Bytes of media stored in this workspace."
                },
                "quotaBytes": {
                  "type": "integer",
                  "description": "Storage quota in bytes for this workspace."
                }
              }
            }
          }
        }
      }
    },
    "limits": {
      "type": "object",
      "description": "The fixed limits scheduling and uploads are validated against.",
      "required": [
        "scheduleAheadDays",
        "minScheduleMinutes",
        "maxFilesPerPost",
        "blockedPlatforms",
        "presignPerMinute"
      ],
      "properties": {
        "scheduleAheadDays": {
          "type": "integer",
          "description": "How far into the future a post may be scheduled."
        },
        "minScheduleMinutes": {
          "type": "integer",
          "description": "Minimum lead time for a scheduled post."
        },
        "maxFilesPerPost": {
          "type": "integer",
          "description": "Maximum media files on one post."
        },
        "blockedPlatforms": {
          "type": "array",
          "description": "Platforms the plan cannot post to.",
          "items": {
            "type": "string"
          }
        },
        "presignPerMinute": {
          "type": "integer",
          "description": "`POST /storage/presign` calls allowed per minute."
        }
      }
    },
    "blocked": {
      "type": "array",
      "description": "Plain-English reasons a write would fail right now, such as a missing plan, a\npast-due subscription or a full queue. Empty when nothing blocks you. Show these to\nthe user instead of attempting the doomed write.\n",
      "items": {
        "type": "string"
      }
    }
  },
  "$defs": {
    "Billing": {
      "type": "object",
      "description": "Subscription state for the workspace.",
      "required": [
        "status",
        "periodEnd",
        "cancelAtPeriodEnd",
        "graceUntil",
        "dunning"
      ],
      "properties": {
        "status": {
          "type": "string",
          "description": "The billing provider's subscription status, such as `active`, `trialing` or `past_due`."
        },
        "periodEnd": {
          "type": "string",
          "format": "date-time",
          "description": "End of the current billing period."
        },
        "cancelAtPeriodEnd": {
          "type": "boolean",
          "description": "Whether the subscription ends at `periodEnd`."
        },
        "graceUntil": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Unix milliseconds until which already-scheduled posts keep publishing after a failed payment. Null when not in dunning."
        },
        "dunning": {
          "type": "boolean",
          "description": "True while payment has failed and the grace window is open. New schedules are refused; scheduled posts still fire until `graceUntil`."
        }
      }
    },
    "Entitlement": {
      "type": "object",
      "description": "One capability and, when it is locked, the lowest plan that allows it.",
      "required": [
        "allowed",
        "requiredPlan"
      ],
      "properties": {
        "allowed": {
          "type": "boolean",
          "description": "Whether the plan behind this token permits the action right now."
        },
        "requiredPlan": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "none",
            "solo",
            "growth",
            "pro",
            null
          ],
          "description": "The lowest plan that allows the action, or null when `allowed` is true."
        }
      }
    },
    "Entitlements": {
      "type": "object",
      "description": "The capability flags that gate this API. Check these before attempting a write rather\nthan discovering a `402` mid-workflow.\n",
      "required": [
        "api",
        "schedule",
        "publish",
        "connectAccount",
        "createWorkspace"
      ],
      "properties": {
        "api": {
          "allOf": [
            {
              "$ref": "#/$defs/Entitlement"
            }
          ],
          "description": "Programmatic access at all. When not allowed, every operation except `GET /me`\nreturns `402`. Requires the Pro plan.\n"
        },
        "schedule": {
          "allOf": [
            {
              "$ref": "#/$defs/Entitlement"
            }
          ],
          "description": "Scheduling for a future time, and by extension media uploads. When not allowed,\n`POST /schedule`, future-dated single-post scheduling and `POST /storage/presign`\nreturn `402`.\n"
        },
        "publish": {
          "allOf": [
            {
              "$ref": "#/$defs/Entitlement"
            }
          ],
          "description": "Publishing immediately. When not allowed, scheduling with no `publishAt` returns `402`."
        },
        "connectAccount": {
          "allOf": [
            {
              "$ref": "#/$defs/Entitlement"
            }
          ],
          "description": "Whether another social account can be connected. Reflects the account slots granted to this customer, not only the plan."
        },
        "createWorkspace": {
          "allOf": [
            {
              "$ref": "#/$defs/Entitlement"
            }
          ],
          "description": "Whether another workspace can be created."
        }
      }
    },
    "Workspace": {
      "type": "object",
      "description": "The account this token belongs to: the boundary around your accounts, posts and media,\nplus the scheduling defaults the bulk scheduler reads.\n",
      "required": [
        "id",
        "name",
        "timezone",
        "defaultTimes"
      ],
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "description": "The account id. You never send it anywhere; quote it if you contact support."
        },
        "name": {
          "type": "string",
          "description": "Display name of the account."
        },
        "timezone": {
          "type": "string",
          "description": "IANA timezone name, such as `America/New_York`. Preset posting times are wall-clock\ntimes in this zone, converted to UTC at scheduling time, so daylight saving is\nhandled for you.\n"
        },
        "defaultTimes": {
          "type": "array",
          "description": "Preset posting times as 24-hour `HH:MM` wall-clock strings in your timezone.\n`POST /schedule` uses these unless you override them, and fails with `422` if this\nlist is empty and you pass none.\n",
          "items": {
            "type": "string",
            "description": "A posting time as `HH:MM` in your timezone.",
            "pattern": "^\\d{2}:\\d{2}$"
          }
        }
      }
    }
  }
}