Skip to content
KrevayadocsGet help Open Krevaya

GraphQL API beta reference

Query account details and posts or create a draft with Krevaya's GraphQL beta. Includes schema fields, variables, errors, and request limits.

Updated

Use GraphQL for the supported core operations

POST https://api.krevaya.com/graphql accepts query, optional variables, and optional operationName. The beta exposes me, posts, and createPost. It uses the same API keys, scopes, plan check, safety checks, and account request budget as REST. Media upload, Canvas editing, webhooks, and job polling use their documented REST or MCP interfaces.

Query account details and drafts

bash
curl --fail-with-body https://api.krevaya.com/graphql \
  -H "Authorization: Bearer $KREVAYA_API_KEY" \
  -H 'Content-Type: application/json' \
  --data '{"query":"query { me { plan scopes } posts(status: \"draft\", limit: 5) { id platform status body scheduledFor mediaCount } }"}'
Query fieldArguments and available fields
meemail, plan, scopes; no additional scope beyond authentication
postsArguments: status, limit, brandId. Requires read. Fields: id, uuid, platform, kind, status, body, hashtags, headline, scheduledFor, mediaCount.

posts defaults to drafts with limit 25, clamped to 1–100. Pass brandId as a GraphQL ID string for an explicit brand. Omitting it follows the dashboard's selected brand. Use GraphQL variables for dynamic content rather than interpolating values into the query string.

Create a draft with variables

json
{
  "query": "mutation CreateDraft($input: CreatePostInput!) { createPost(input: $input) { id platform kind status scheduledAt } }",
  "variables": {
    "input": {
      "platform": "linkedin",
      "body": "We now record the reported symptom before starting a repair estimate.",
      "brandId": "YOUR_BRAND_ID"
    }
  },
  "operationName": "CreateDraft"
}

CreatePostInput requires platform and body. Optional fields are hashtags, scheduleAt, kind, assetIds, and brandId. The mutation requires publish. Omit scheduleAt to create a draft; a future ISO-8601 value schedules it directly. The result exposes id, platform, kind, status, and scheduledAt. The beta input does not include native layout, template, or design_id.

Use the documented schema

graphql
type Query {
  me: Me!
  posts(status: String, limit: Int, brandId: ID): [Post!]!
}

type Mutation {
  createPost(input: CreatePostInput!): CreatePostResult!
}

input CreatePostInput {
  platform: String!
  body: String!
  hashtags: String
  scheduleAt: String
  kind: String
  assetIds: [ID!]
  brandId: ID
}

IDs are GraphQL ID values serialized as strings, not GraphQL Int. Schema introspection is disabled. A query string is limited to 2,000 characters, with at most eight root query fields, one root mutation field, and 60 selected fields.

Check errors even when HTTP status is 200

Syntax, schema validation, and breadth-limit failures return HTTP 400 with data: null and errors. Authentication and account throttling can fail before execution. Resolver execution errors, including a missing scope or invalid createPost input, can return HTTP 200 with errors. Read both response.ok and the errors array before using data.

javascript
const payload = await response.json();
if (!response.ok || payload.errors?.length) {
  throw new Error(JSON.stringify(payload.errors ?? payload));
}
const drafts = payload.data.posts;

Frequently asked questions

Does the GraphQL beta expose every REST or MCP operation?

No. Its current operations are me, posts, and createPost. Use REST or MCP for media, design editing, brand memory, scheduling existing posts, and job polling.

Why does GraphQL return HTTP 200 with an error?

GraphQL execution errors use the errors array even when transport succeeded. Check that array before treating the operation as successful.