> ## Documentation Index
> Fetch the complete documentation index at: https://docs.acedata.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate

> Generate the corresponding certificate photo according to the template name and the entered person picture.



## OpenAPI

````yaml /openapi/drawai.json post /headshots/generate
openapi: 3.0.0
info:
  title: AI ID Photo Production
  version: 1.0.0
  description: API reference for AI ID Photo Production on Ace Data Cloud.
servers:
  - url: https://api.acedata.cloud
    description: Ace Data Cloud API
security:
  - bearerAuth: []
paths:
  /headshots/generate:
    post:
      summary: Generate
      description: >-
        Generate the corresponding certificate photo according to the template
        name and the entered person picture.
      parameters:
        - in: header
          name: accept
          schema:
            enum:
              - application/json
            type: string
          required: false
          description: Headshots Generate Param Accept
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - template
                - mode
                - image_urls
              properties:
                mode:
                  enum:
                    - fast
                    - relax
                  type: string
                  default: fast
                  description: Headshots Generate Mode
                template:
                  enum:
                    - male_portrait
                    - male_portrait2
                    - kindergarten
                    - logo_tshirt
                    - wedding
                    - business_photo
                    - bob_suit
                    - female_portrait
                  type: string
                  description: Headshots Generate Template
                image_urls:
                  type: array
                  items:
                    type: string
                  description: Headshots Generate Image Urls
                callback_url:
                  type: string
                  description: Headshots Generate Callback Url
                async:
                  type: boolean
                  description: Headshots Generate Async
            example:
              template: business_photo
              mode: fast
              image_urls:
                - https://cdn.acedata.cloud/4hfydw.jpg
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                type: object
                example:
                  data:
                    - id: '202410231117'
                      template: 男形象照
                      image_url: https://static.aipedias.com/aicamera/....
                    - id: '2024102311170'
                      template: 男形象照
                      image_url: https://static.aipedias.com/aicamera/....
                  success: true
                  task_id: 5636d6ba-957f-475e-a98a-718a07ee89a6
                properties:
                  data:
                    type: array
                    description: Headshots Generate Response 200 Data
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: Headshots Generate Response 200 Data Id
                        template:
                          type: string
                          description: Headshots Generate Response 200 Data Template
                        image_url:
                          type: string
                          description: Headshots Generate Response 200 Data Image Url
                  success:
                    type: boolean
                    description: Headshots Generate Response 200 Success
                  task_id:
                    type: string
                    description: Headshots Generate Response 200 Task Id
          description: Headshots Generate Response 200
        '400':
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    example:
                      error:
                        code: bad_request
                        message: The json payload is not valid to request the API
                      trace_id: 2efa9340-b21b-4e26-9e14-4aac95f343ab
                    properties:
                      error:
                        type: object
                        properties:
                          code:
                            type: string
                            example: bad_request
                            description: Headshots Generate Response 400 Error Code
                          message:
                            type: string
                            example: prompt is required
                            description: Headshots Generate Response 400 Error Message
                      trace_id:
                        type: string
                        description: Headshots Generate Response 400 Trace Id
                  - type: object
                    example:
                      error:
                        code: token_mismatched
                        message: The specified token is not matched with API.
                      trace_id: 2efa9340-b21b-4e26-9e14-4aac95f343ab
                    properties:
                      error:
                        type: object
                        properties:
                          code:
                            type: string
                            example: token_mismatched
                            description: Headshots Generate Response 400 Error Code 2
                          message:
                            type: string
                            example: The specified token is not matched with API.
                            description: Headshots Generate Response 400 Error Message 2
                      trace_id:
                        type: string
                        description: Headshots Generate Response 400 Trace Id 2
                  - type: object
                    example:
                      error:
                        code: api_not_implemented
                        message: The API is not implemented.
                      trace_id: 2efa9340-b21b-4e26-9e14-4aac95f343ab
                    properties:
                      error:
                        type: object
                        properties:
                          code:
                            type: string
                            example: api_not_implemented
                            description: Headshots Generate Response 400 Error Code 3
                          message:
                            type: string
                            example: The API is not implemented.
                            description: Headshots Generate Response 400 Error Message 3
                      trace_id:
                        type: string
                        description: Headshots Generate Response 400 Trace Id 3
          description: Headshots Generate Response 400
        '401':
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    example:
                      error:
                        code: invalid_token
                        message: The specified token is invalid or wrong.
                      trace_id: 2efa9340-b21b-4e26-9e14-4aac95f343ab
                    properties:
                      error:
                        type: object
                        properties:
                          code:
                            type: string
                            example: invalid_token
                            description: Headshots Generate Response 401 Error Code
                          message:
                            type: string
                            example: The specified token is invalid or wrong.
                            description: Headshots Generate Response 401 Error Message
                      trace_id:
                        type: string
                        description: Headshots Generate Response 401 Trace Id
          description: Headshots Generate Response 401
        '403':
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    example:
                      error:
                        code: forbidden
                        message: >-
                          Sorry! Our Al moderators feel your prompt might be
                          against our community standards.
                      trace_id: 2efa9340-b21b-4e26-9e14-4aac95f343ab
                    properties:
                      error:
                        type: object
                        properties:
                          code:
                            type: string
                            example: forbidden
                            description: Headshots Generate Response 403 Error Code
                          message:
                            type: string
                            example: >-
                              Sorry! Our Al moderators feel your prompt might be
                              against our community standards.
                            description: Headshots Generate Response 403 Error Message
                      trace_id:
                        type: string
                        description: Headshots Generate Response 403 Trace Id
          description: Headshots Generate Response 403
        '429':
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    example:
                      error:
                        code: too_many_requests
                        message: You have exceeded the rate limit.
                      trace_id: 2efa9340-b21b-4e26-9e14-4aac95f343ab
                    properties:
                      error:
                        type: object
                        properties:
                          code:
                            type: string
                            example: too_many_requests
                            description: Headshots Generate Response 429 Error Code
                          message:
                            type: string
                            example: You have exceeded the rate limit.
                            description: Headshots Generate Response 429 Error Message
                      trace_id:
                        type: string
                        description: Headshots Generate Response 429 Trace Id
          description: Headshots Generate Response 429
        '500':
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    example:
                      error:
                        code: api_error
                        message: Internal server error.
                      trace_id: 2efa9340-b21b-4e26-9e14-4aac95f343ab
                    properties:
                      error:
                        type: object
                        properties:
                          code:
                            type: string
                            example: api_error
                            description: Headshots Generate Response 500 Error Code
                          message:
                            type: string
                            example: Internal server error.
                            description: Headshots Generate Response 500 Error Message
                      trace_id:
                        type: string
                        description: Headshots Generate Response 500 Trace Id
          description: Headshots Generate Response 500
        '504':
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    example:
                      error:
                        code: timeout
                        message: Timeout to generate the image.
                      trace_id: 2efa9340-b21b-4e26-9e14-4aac95f343ab
                    properties:
                      error:
                        type: object
                        properties:
                          code:
                            type: string
                            example: timeout
                            description: Headshots Generate Response 504 Error Code
                          message:
                            type: string
                            example: Timeout to generate the image.
                            description: Headshots Generate Response 504 Error Message
                      trace_id:
                        type: string
                        description: Headshots Generate Response 504 Trace Id
          description: Headshots Generate Response 504
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API token from https://platform.acedata.cloud

````