---
title: "Generate AI Prompt Completion"
method: POST
path: "/users/{userId}/ai/prompts/{aiPromptId}/completions"
tags: ["AI"]
---

# Generate AI Prompt Completion

`POST /users/{userId}/ai/prompts/{aiPromptId}/completions`

## Request

- Base URL: `https://api.crowdin.com/api/v2`
- URL: `https://api.crowdin.com/api/v2/users/{userId}/ai/prompts/{aiPromptId}/completions`
- Auth: none declared
- TypeScript: <https://skmtc.dev/crowdin/apis/crowdin-api-v2/docs/users/:userId/ai/prompts/:aiPromptId/completions/post.ts> (a function with typed inputs; its response is checked against the schema)

**Required scopes:** `ai.prompt` (Read only).

## Path parameters

- `userId` integer, required
- `aiPromptId` integer, required

## Request body

- CrowdinAiPromptCompletionCreateForm
  - `resources` union, required
    - AiPromptCompletionResourcesPreTranslate
      - `projectId` integer, required
      - `sourceLanguageId` string: __Note__: If not specified, the source language of the project will be used
      - `targetLanguageId` string
      - `stringIds` integer[]: __Note:__ Must be used together with `targetLanguageId`. You can assign up to 500 strings at a time.
      - `overridePromptValues` AiPromptCompletionResourcesOverridePromptValuesPreTranslate
        - `sourceLanguage` string
        - `targetLanguage` string
        - `strings` string: Example: `{"strings":[{"id":5515318,"text":"About...","key":"about","context":"about","maxLength":null},{"id":5515319,"text":"About Me","key":"about_me","context":"about_me","maxLength":null},{"id":5515320,"text":"Current Password","key":"current_password","context":"current_password","maxLength":null}]}` __Note:__ The provided data should follow the structure shown. Each object in the array must include a 'text' field. Other fields such as 'id', 'key', 'context', and 'maxLength' are optional. You can also include custom properties as needed.
        - `tm` string
        - `terms` string
        - `fileName` string
        - `fileContext` string
        - `siblingsStrings` string
        - `projectName` string
        - `projectDescription` string
        - `projectPublicDescription` string: Deprecated. Use `projectDescription` instead.
        - `pluralForms` string
        - `fileContent` string
    - AiPromptCompletionResourcesQaCheck
      - `projectId` integer, required
      - `sourceLanguageId` string: __Note__: If not specified, the source language of the project will be used
      - `targetLanguageId` string
      - `stringIds` integer[]: __Note:__ Must be used together with `targetLanguageId`. You can assign up to 500 strings at a time.
      - `overridePromptValues` AiPromptCompletionResourcesOverridePromptValuesQaCheck
        - `sourceLanguage` string
        - `targetLanguage` string
        - `translationUnits` string: Example: `{"translationUnits":[{"id":"c9f4b768-5d71-4fd6-a3db-85f1f8dbe664","source":{"id":5515320,"text":"Current Password","key":"current_password","context":"current_password","maxLength":null},"translation":{"id":5515321,"text":"Створити пароль"}}]}` __Note:__ The provided data should follow the structure shown. Each object in the array must include a 'source.text' and 'translation.text' field. Other fields such as 'id' are optional. You can also include custom properties as needed.
        - `tm` string
        - `terms` string
        - `fileName` string
        - `fileContext` string
        - `projectName` string
        - `projectDescription` string
        - `projectPublicDescription` string: Deprecated. Use `projectDescription` instead.
    - AiPromptCompletionResourcesCustom
      - `projectId` integer, required
      - `sourceLanguageId` string: __Note__: If not specified, the source language of the project will be used
      - `targetLanguageId` string
      - `stringIds` integer[]: __Note:__ Must be used together with `targetLanguageId`. You can assign up to 500 strings at a time.
      - `overridePromptValues` AiPromptCompletionResourcesOverridePromptValuesCustom
        - `sourceLanguage` string
        - `targetLanguage` string
        - `strings` string: Example: `{"strings":[{"id":5515318,"text":"About...","key":"about","context":"about","maxLength":null},{"id":5515319,"text":"About Me","key":"about_me","context":"about_me","maxLength":null},{"id":5515320,"text":"Current Password","key":"current_password","context":"current_password","maxLength":null}]}` __Note:__ The provided data should follow the structure shown. Each object in the array must include a 'text' field. Other fields such as 'id', 'key', 'context', and 'maxLength' are optional. You can also include custom properties as needed.
        - `tm` string
        - `terms` string
        - `fileName` string
        - `fileContext` string
        - `siblingsStrings` string
        - `projectName` string
        - `projectDescription` string
        - `projectPublicDescription` string: Deprecated. Use `projectDescription` instead.
        - `fileContent` string
        - `filteredStrings` string
      - `customInstruction` string
  - `tools` object[]: List of AI Tools
    - `tool` object: AI Tool
      - `type` 'function', required: The type of the tool. Currently, only `function` is supported.
      - `function` object, required
        - `description` string: A description of what the function does, used by the AI to choose when and how to call the function.
        - `name` string, required: The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
        - `parameters` object: The parameters the functions accepts, described as a JSON Schema object. See [JSON Schema reference](https://json-schema.org/understanding-json-schema) for documentation about the format.
  - `tool_choice` union
    - string
    - object

## Response `201`

AI prompt completion job was added successfully

- AiPromptCompletionResource: Base schema of resource container. Container is a wrapper object that contains payload in required `data` property and provides space for adding any other metadata.
  - `data` AiPromptCompletion, required
    - `identifier` string
    - `status` string
    - `progress` integer: in percentages
    - `attributes` object
      - `aiPromptId` integer
    - `createdAt` string, date-time
    - `updatedAt` string, date-time
    - `startedAt` string, date-time
    - `finishedAt` string, date-time
    - `eta` string

## Other responses

- `400`: Invalid Request Parameters
- `401`: Unauthorized
- `403`: Forbidden
- `405`: Method Not Allowed
- `409`: Conflict

---

[API](https://skmtc.dev/crowdin/apis/crowdin-api-v2.md) - [All operations](https://skmtc.dev/crowdin/apis/crowdin-api-v2/llms.txt) - [OpenAPI document](https://skmtc.dev/crowdin/apis/crowdin-api-v2/revisions/27aae7751699?raw)
