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

# Create or update an activity type

> Creates the activity type with this key, or updates its name and description. Sending an archived type restores it, but its activities stay archived until each is sent again. With createOnly set to true, an active type with this key fails with 409 and nothing changes; an archived one is still restored. The key is limited to 512 characters. A field the request does not define fails validation. No text can contain the NUL character (U+0000) or a lone UTF-16 surrogate (U+D800 to U+DFFF). To send activities of the type, use PUT /c/{companyId}/activities. Requires permission to manage activities (`activities.manage`).



## OpenAPI

````yaml https://api.gowindmill.com/api/v2/openapi.json put /c/{companyId}/activity-types/{externalId}
openapi: 3.1.0
info:
  title: Windmill API
  version: 2.0.0
  description: >-
    Use the Windmill API to integrate your systems, automate workflows, and
    build applications on your organization's data. Authenticate with an API key
    or OAuth access token. Each request uses the authenticated user's
    permissions within the selected workspace.
servers:
  - url: https://api.gowindmill.com/api/v2
security:
  - bearerAuth: []
paths:
  /c/{companyId}/activity-types/{externalId}:
    put:
      tags:
        - Activities
      summary: Create or update an activity type
      description: >-
        Creates the activity type with this key, or updates its name and
        description. Sending an archived type restores it, but its activities
        stay archived until each is sent again. With createOnly set to true, an
        active type with this key fails with 409 and nothing changes; an
        archived one is still restored. The key is limited to 512 characters. A
        field the request does not define fails validation. No text can contain
        the NUL character (U+0000) or a lone UTF-16 surrogate (U+D800 to
        U+DFFF). To send activities of the type, use PUT
        /c/{companyId}/activities. Requires permission to manage activities
        (`activities.manage`).
      operationId: activityTypes.upsert
      parameters:
        - schema:
            type: string
            minLength: 1
            maxLength: 128
            description: >-
              Company ID. A URL slug is also accepted. The caller must have
              access to this company.
            title: Company ID
            example: company-acme
          required: true
          description: >-
            Company ID. A URL slug is also accepted. The caller must have access
            to this company.
          name: companyId
          in: path
        - schema:
            type: string
            maxLength: 512
            pattern: \S
          required: true
          name: externalId
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpsertActivityTypeRequest'
      responses:
        '200':
          description: The created or updated activity type.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActivityType'
        '400':
          description: Bad request or request validation failed
          content:
            application/json:
              schema:
                anyOf:
                  - type: object
                    properties:
                      error:
                        type: object
                        properties:
                          code:
                            type: string
                            enum:
                              - BAD_REQUEST
                          message:
                            type: string
                          requestId:
                            type: string
                          details:
                            type: array
                            items:
                              type: object
                              properties:
                                path:
                                  type: array
                                  items:
                                    anyOf:
                                      - type: string
                                      - type: number
                                message:
                                  type: string
                                resourceId:
                                  type: string
                              required:
                                - path
                                - message
                            description: >-
                              Each request item that failed, by its path in the
                              request, when the operation identifies them.
                              resourceId names an existing resource the failure
                              concerns.
                        required:
                          - code
                          - message
                          - requestId
                    required:
                      - error
                  - type: object
                    properties:
                      error:
                        type: object
                        properties:
                          code:
                            type: string
                            enum:
                              - VALIDATION_ERROR
                          message:
                            type: string
                          requestId:
                            type: string
                          details:
                            type: array
                            items:
                              type: object
                              properties:
                                path:
                                  type: array
                                  items:
                                    anyOf:
                                      - type: string
                                      - type: number
                                message:
                                  type: string
                              required:
                                - path
                                - message
                        required:
                          - code
                          - message
                          - requestId
                          - details
                    required:
                      - error
        '401':
          description: >-
            Authentication is missing or invalid. Send a valid API key or OAuth
            access token in the Authorization: Bearer <TOKEN> header before
            retrying.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - UNAUTHORIZED
                      message:
                        type: string
                      requestId:
                        type: string
                    required:
                      - code
                      - message
                      - requestId
                required:
                  - error
        '403':
          description: >-
            The authenticated user lacks the workspace capability this operation
            requires (`activities.manage`). Read-only API keys cannot call this
            operation. This status is also returned when the API key or OAuth
            access token cannot access the workspace in the URL. A token works
            only in the workspace it was issued for, and only while its user is
            a member of that workspace.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - FORBIDDEN
                      message:
                        type: string
                      requestId:
                        type: string
                      details:
                        type: array
                        items:
                          type: object
                          properties:
                            path:
                              type: array
                              items:
                                anyOf:
                                  - type: string
                                  - type: number
                            message:
                              type: string
                            resourceId:
                              type: string
                          required:
                            - path
                            - message
                        description: >-
                          Each request item you lack permission for, by its path
                          in the request, when the operation identifies them.
                          resourceId names an existing resource the failure
                          concerns.
                    required:
                      - code
                      - message
                      - requestId
                required:
                  - error
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - CONFLICT
                      message:
                        type: string
                      requestId:
                        type: string
                      details:
                        type: array
                        items:
                          type: object
                          properties:
                            path:
                              type: array
                              items:
                                anyOf:
                                  - type: string
                                  - type: number
                            message:
                              type: string
                            resourceId:
                              type: string
                          required:
                            - path
                            - message
                        description: >-
                          Request fields that caused the conflict, when the
                          operation identifies them. resourceId names the
                          existing resource that conflicts.
                    required:
                      - code
                      - message
                      - requestId
                required:
                  - error
        '429':
          description: >-
            The API-client request budget is exhausted. API keys allow 500
            requests per minute per key; OAuth clients allow 500 per minute per
            client and workspace. Reads and writes share the budget. One HTTP
            request counts once, including bulk requests. Wait for the
            Retry-After delay before retrying.
          headers:
            Retry-After:
              description: Number of seconds to wait before retrying the request.
              required: true
              schema:
                type: integer
                minimum: 0
                example: 42
            RateLimit:
              description: >-
                Current request budget: limit is the maximum count, remaining is
                the unused count, and reset is seconds until the window resets,
                not a timestamp.
              required: true
              schema:
                type: string
                example: limit=500, remaining=0, reset=42
            RateLimit-Policy:
              description: >-
                Request limit and window length in seconds, formatted as
                <limit>;w=<seconds>.
              required: true
              schema:
                type: string
                example: 500;w=60
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - RATE_LIMITED
                      message:
                        type: string
                      requestId:
                        type: string
                    required:
                      - code
                      - message
                      - requestId
                required:
                  - error
      security:
        - bearerAuth: []
components:
  schemas:
    UpsertActivityTypeRequest:
      type: object
      properties:
        name:
          type: string
          pattern: \S
        description:
          type: string
          pattern: \S
        createOnly:
          type: boolean
          description: >-
            Set true to create the type only when no active type has this key;
            otherwise the request fails with 409 and changes nothing. An
            archived type with this key is still restored and updated.
      required:
        - name
        - description
      additionalProperties: false
    ActivityType:
      type: object
      properties:
        id:
          type: string
          description: Windmill's identifier for the type.
          example: 019a2f7c-1b2d-7e3f-9a4b-5c6d7e8f9a0b
        externalId:
          type: string
          description: >-
            Your key for the type, unique in the company, at most 512
            characters. Activities name their type by this key.
          example: call-score
        name:
          type: string
          description: The name people see for the type.
          example: Call score
        description:
          type: string
          description: >-
            What the event is and how to read its properties, for example the
            range of a score. Windy uses it to interpret the type's activities.
          example: A scored sales call. properties.score is 0 to 100.
        createdAt:
          type: string
          format: date-time
          description: When the type was created.
        updatedAt:
          type: string
          format: date-time
          description: When the type was last changed.
      required:
        - id
        - externalId
        - name
        - description
        - createdAt
        - updatedAt
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Use an API key or OAuth access token. Enter only the token in the
        authorization dialog; requests send it as `Authorization: Bearer
        <TOKEN>`.


        Create an API key in your workspace's **Settings → API keys**. Keys
        start with `wm_api_` and only work in the workspace where they were
        created. Read-only keys can read data; creating, updating, or deleting
        data requires a read-write key.


        ```http

        Authorization: Bearer wm_api_example

        ```


        OAuth access tokens are issued for connected Windmill applications.


        ```http

        Authorization: Bearer <OAUTH_ACCESS_TOKEN>

        ```


        Both token types use the authenticated user's workspace permissions.
        Each endpoint's permission requirements and the sharing settings of the
        requested items still apply.

````

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