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

# Update a string

> Requires `strings:write`. Native projects only. Send `null` to clear `context` or `maxLength`. Changing `sourceText` on a locked segment returns `409`, and so does changing the `sourceText` of a string in a file while the project's "Allow source text editing" setting is off, or of a hidden string, or in a file that isn't JSON, JSONC or ARB, came from an integration, or was last uploaded before uploads were recorded (`source_text_not_editable`). New `sourceText` holding the control characters U+001E or U+0000 returns `400` (`invalid_source_text`). Only admins, localization managers and developers may change the `sourceText` of a string in a file (`403`). Surrounding spaces alone are not a change. In a project whose "When source text changes" setting is "Needs review", changing `sourceText` moves the string's approved translations back to `needs_review`, unless `keepApproved` is `true`.



## OpenAPI

````yaml https://public-api.hyperlocalise.com/openapi.yaml patch /v1/projects/{projectId}/strings/{stringId}
openapi: 3.1.0
info:
  title: Hyperlocalise Public API
  version: 1.0.0
  description: >-
    Read projects, Queries, jobs, glossaries, and translation memories from a
    Hyperlocalise workspace; create native projects from project templates and
    manage those templates; define custom project fields and set their values;
    manage the strings, translations, screenshots, and settings of native
    projects; search strings; round-trip bilingual files; update jobs one at a
    time or in bulk; register job-change webhook endpoints; import and export
    glossaries and translation memories; and read the Reports page's reports as
    JSON or CSV.
servers:
  - url: https://public-api.hyperlocalise.com
security:
  - personalAccessToken: []
tags:
  - name: Identity
  - name: Projects
  - name: Project templates
  - name: Custom fields
  - name: Queries
  - name: Jobs
  - name: Strings
  - name: Translations
  - name: Screenshots
  - name: Figma attachments
  - name: Bilingual files
  - name: Glossaries
  - name: Translation memories
  - name: Webhooks
  - name: CDN
  - name: Hyperlab
  - name: Reports
    description: >-
      The Reports page's reports for scripts, BI tools and payment systems.
      Every report needs `reports:read`, which only admins' and localization
      managers' keys hold, and the workspace's Reports feature. Each answer says
      whether recent work is still being counted (`stillUpdating`); figures can
      lag live work by one capture run. A workspace may ask for 30 reports a
      minute, in bursts of 10.
paths:
  /v1/projects/{projectId}/strings/{stringId}:
    parameters:
      - $ref: '#/components/parameters/ProjectId'
      - $ref: '#/components/parameters/StringId'
    patch:
      tags:
        - Strings
      summary: Update a string
      description: >-
        Requires `strings:write`. Native projects only. Send `null` to clear
        `context` or `maxLength`. Changing `sourceText` on a locked segment
        returns `409`, and so does changing the `sourceText` of a string in a
        file while the project's "Allow source text editing" setting is off, or
        of a hidden string, or in a file that isn't JSON, JSONC or ARB, came
        from an integration, or was last uploaded before uploads were recorded
        (`source_text_not_editable`). New `sourceText` holding the control
        characters U+001E or U+0000 returns `400` (`invalid_source_text`). Only
        admins, localization managers and developers may change the `sourceText`
        of a string in a file (`403`). Surrounding spaces alone are not a
        change. In a project whose "When source text changes" setting is "Needs
        review", changing `sourceText` moves the string's approved translations
        back to `needs_review`, unless `keepApproved` is `true`.
      operationId: updateString
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              minProperties: 1
              properties:
                sourceText:
                  type: string
                  minLength: 1
                  maxLength: 100000
                context:
                  type:
                    - string
                    - 'null'
                  maxLength: 10000
                maxLength:
                  type:
                    - integer
                    - 'null'
                  minimum: 1
                  maximum: 100000
                hidden:
                  type: boolean
                keepApproved:
                  type: boolean
                  default: false
                  description: >-
                    Keep approved translations approved for this source text
                    change, for a typo or punctuation fix. Not a change on its
                    own.
                customMetadata:
                  type: object
                  maxProperties: 100
                  propertyNames:
                    pattern: ^[A-Za-z0-9][A-Za-z0-9_.-]{0,63}$
                  additionalProperties:
                    type:
                      - string
                      - 'null'
                    maxLength: 2000
                  description: >-
                    Merged into the string's custom metadata: a string sets the
                    key, `null` removes it, and keys you leave out are kept. A
                    string holds at most 50 keys (`400
                    invalid_custom_metadata`).
      responses:
        '200':
          description: Updated string.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StringResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '413':
          $ref: '#/components/responses/PayloadTooLarge'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '503':
          $ref: '#/components/responses/Unavailable'
components:
  parameters:
    ProjectId:
      name: projectId
      in: path
      required: true
      schema:
        type: string
        maxLength: 128
    StringId:
      name: stringId
      in: path
      required: true
      schema:
        type: string
        format: uuid
  schemas:
    StringResponse:
      type: object
      required:
        - string
      properties:
        string:
          $ref: '#/components/schemas/String'
    String:
      type: object
      required:
        - id
        - key
        - sourceText
        - context
        - type
        - maxLength
        - hidden
        - filePath
        - tags
        - designUrl
        - customMetadata
        - createdAt
        - updatedAt
      properties:
        id:
          type: string
          format: uuid
        key:
          type: string
        sourceText:
          type: string
        context:
          type:
            - string
            - 'null'
        type:
          type:
            - string
            - 'null'
        maxLength:
          type:
            - integer
            - 'null'
        hidden:
          type: boolean
        filePath:
          type:
            - string
            - 'null'
        tags:
          type: array
          items:
            $ref: '#/components/schemas/Tag'
        designUrl:
          type:
            - string
            - 'null'
          description: Link to the design where the string appears.
        customMetadata:
          $ref: '#/components/schemas/CustomMetadata'
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    Error:
      type: object
      required:
        - error
        - message
      properties:
        error:
          type: string
        message:
          type: string
        details:
          type: object
          description: >-
            Structured context, such as the `jobId` that stopped a bulk job
            update.
          additionalProperties: true
    Tag:
      type: string
      pattern: ^[A-Za-z0-9_-]{1,64}$
    CustomMetadata:
      type: object
      maxProperties: 50
      propertyNames:
        pattern: ^[A-Za-z0-9][A-Za-z0-9_.-]{0,63}$
      additionalProperties:
        type: string
        maxLength: 2000
      description: >-
        Your own text on the string, by key, such as a ticket or a source
        system's ID. Only the API reads and writes it. Linguists and machine
        translation don't see it, so put guidance for translators in `context`.
  responses:
    BadRequest:
      description: Invalid query parameters or request body.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: The personal access token is missing or invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: The token lacks the required scope or workspace access.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: The resource is missing or inaccessible.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Conflict:
      description: >-
        The project is not native, the key already exists, the segment is
        locked, the webhook endpoint limit was reached, or the job, memory, or
        glossary is managed elsewhere or archived.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    PayloadTooLarge:
      description: >-
        The request body exceeds 256 KiB (16 MiB for a strings batch, 25 MiB for
        a bilingual file or a memory or glossary import).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    UnsupportedMediaType:
      description: The request body has an unsupported media type.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unavailable:
      description: Authentication or resource storage is temporarily unavailable.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    personalAccessToken:
      type: apiKey
      in: header
      name: x-api-key

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.