{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/canva/json-schema/canva-create-image-generation-job-response-schema.json",
  "title": "CreateImageGenerationJobResponse",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/canva-image-generation-api-openapi.yml#/components/schemas/CreateImageGenerationJobResponse",
  "properties": {
    "job": {
      "$ref": "#/$defs/ImageGenerationJob"
    },
    "quota_usage": {
      "allOf": [
        {
          "$ref": "#/$defs/CreditQuotaSuccessInfo"
        }
      ],
      "description": "Credit quota usage after reserving credits for this job. Not present if quota data is unavailable."
    }
  },
  "required": [
    "job"
  ],
  "type": "object",
  "$defs": {
    "AssetSummary": {
      "description": "An object representing an asset with associated metadata.",
      "properties": {
        "type": {
          "$ref": "#/$defs/AssetType"
        },
        "id": {
          "description": "The ID of the asset.",
          "type": "string"
        },
        "name": {
          "description": "The name of the asset.",
          "type": "string"
        },
        "tags": {
          "description": "The user-facing tags attached to the asset.\nUsers can add these tags to their uploaded assets, and they can search their uploaded\nassets in the Canva UI by searching for these tags. For information on how users use\ntags, see the\n[Canva Help Center page on asset tags](https://www.canva.com/help/add-edit-tags/).",
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "created_at": {
          "description": "When the asset was added to Canva, as a Unix timestamp (in seconds since the Unix\nEpoch).",
          "format": "int64",
          "type": "integer"
        },
        "updated_at": {
          "description": "When the asset was last updated in Canva, as a Unix timestamp (in seconds since the\nUnix Epoch).",
          "format": "int64",
          "type": "integer"
        },
        "thumbnail": {
          "$ref": "#/$defs/Thumbnail"
        }
      },
      "required": [
        "created_at",
        "id",
        "name",
        "tags",
        "type",
        "updated_at"
      ],
      "type": "object"
    },
    "AssetType": {
      "description": "Type of an asset.",
      "enum": [
        "image",
        "video"
      ],
      "type": "string"
    },
    "CreditQuotaSuccessInfo": {
      "allOf": [
        {
          "$ref": "#/$defs/CreditQuotaUsageSummary"
        },
        {
          "properties": {
            "usage_review_link": {
              "description": "A URL to the Canva credit usage dashboard where the caller can review their\ncurrent credit consumption. Not present if unavailable.",
              "type": "string"
            }
          },
          "type": "object"
        }
      ],
      "description": "Credit quota usage information returned on a successful generation request."
    },
    "CreditQuotaUsageSummary": {
      "description": "A summary of the caller's credit quota usage at the time of the request.",
      "properties": {
        "used_percentage": {
          "description": "The percentage of the caller's credit quota that has been consumed in the current\nbilling interval, from 0 to 100.",
          "format": "int32",
          "maximum": 100,
          "minimum": 0,
          "type": "integer"
        },
        "resets_at": {
          "description": "Unix timestamp (seconds from the Unix epoch) of when the credit quota resets for\nthe caller.",
          "format": "int64",
          "type": "integer"
        },
        "using_bonus_credits": {
          "description": "Whether the caller is currently consuming bonus credits (credits beyond their base\nplan allocation).",
          "type": "boolean"
        }
      },
      "type": "object"
    },
    "GeneratedImage": {
      "description": "A generated image.",
      "properties": {
        "url": {
          "description": "A download URL for the generated image. The download URL is only valid for 24\nhours.",
          "type": "string"
        },
        "asset": {
          "allOf": [
            {
              "$ref": "#/$defs/AssetSummary"
            }
          ],
          "description": "The image asset the generated image was saved as. Only present if the job was created\nwith `asset_upload` set to `type: upload` and the asset still exists (for example, it's\nabsent if the user has since deleted the asset)."
        },
        "width": {
          "description": "The width of the generated image in pixels.",
          "format": "int32",
          "type": "integer"
        },
        "height": {
          "description": "The height of the generated image in pixels.",
          "format": "int32",
          "type": "integer"
        }
      },
      "required": [
        "height",
        "url",
        "width"
      ],
      "type": "object"
    },
    "ImageGenerationError": {
      "description": "If the image generation job fails, this object provides details about the error. Only present if status is `failed`.",
      "properties": {
        "code": {
          "$ref": "#/$defs/ImageGenerationErrorCode"
        },
        "message": {
          "description": "A human-readable description of what went wrong.",
          "type": "string"
        }
      },
      "required": [
        "code",
        "message"
      ],
      "type": "object"
    },
    "ImageGenerationErrorCode": {
      "description": "Error code indicating what went wrong with the image generation.",
      "enum": [
        "unsafe_input",
        "timeout",
        "model_not_available",
        "model_retired",
        "internal_error"
      ],
      "type": "string",
      "x-enum-descriptions": [
        "Content safety checks rejected the prompt.",
        "The generation did not complete in time.",
        "The requested model can't currently serve this request, and Canva doesn't retry the job\nwith another model. This is usually temporary. Retry later, retry without the `model`\nparameter to use automatic model selection, or retry with a different model.",
        "The requested model has been permanently retired from this version of the API, and you\ncan't use it again in this version. Use a different model. The API documentation lists\nretired models, which keep their enum value for the lifetime of this API version.",
        "An unexpected error occurred during generation."
      ]
    },
    "ImageGenerationJob": {
      "description": "Details about the image generation job. If the job status is `success`, the job's\n`result` is present.",
      "properties": {
        "id": {
          "description": "The image generation job ID.",
          "pattern": "^[a-zA-Z0-9_-]{1,50}$",
          "type": "string"
        },
        "status": {
          "$ref": "#/$defs/ImageGenerationJobStatus"
        },
        "result": {
          "$ref": "#/$defs/ImageGenerationJobResult"
        },
        "error": {
          "$ref": "#/$defs/ImageGenerationError"
        }
      },
      "required": [
        "id",
        "status"
      ],
      "type": "object"
    },
    "ImageGenerationJobResult": {
      "description": "Result of the image generation job. Only present if job status is `success`.",
      "properties": {
        "image": {
          "$ref": "#/$defs/GeneratedImage"
        }
      },
      "required": [
        "image"
      ],
      "type": "object"
    },
    "ImageGenerationJobStatus": {
      "description": "The status of the image generation job. A newly created job will be `in_progress` and\nwill eventually become `success` or `failed`. If the status is `success`, the job's\n`result` is present.",
      "enum": [
        "failed",
        "in_progress",
        "success"
      ],
      "type": "string"
    },
    "Thumbnail": {
      "description": "A thumbnail image representing the object.",
      "properties": {
        "width": {
          "description": "The width of the thumbnail image in pixels.",
          "format": "int32",
          "type": "integer"
        },
        "height": {
          "description": "The height of the thumbnail image in pixels.",
          "format": "int32",
          "type": "integer"
        },
        "url": {
          "description": "A URL for retrieving the thumbnail image.\nThis URL expires after 15 minutes. This URL includes a query string\nthat's required for retrieving the thumbnail.",
          "type": "string"
        }
      },
      "required": [
        "height",
        "url",
        "width"
      ],
      "type": "object"
    }
  }
}