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

# Mark Environment Active

> Records environment activity to prevent automatic shutdown.

`Unary` · [`Environments`](https://ona.com/docs/api-reference/generated/environment/overview)

Records environment activity to prevent automatic shutdown.

Activity signals should be sent every 5 minutes while the environment
is actively being used. The source must be between 3-80 characters.

### Examples

* Signal VS Code activity:

  Records VS Code editor activity to prevent environment shutdown.

  ```yaml theme={null}
  environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048"
  activitySignal:
    source: "VS Code"
    timestamp: "2025-02-12T14:30:00Z"
  ```

## Endpoint

```text theme={null}
POST /api/gitpod.v1.EnvironmentService/MarkEnvironmentActive
```

Send a Bearer token as described in [Authentication](https://ona.com/docs/api-reference.md#authenticate-requests). If your organization uses a custom management-plane domain, replace `https://app.ona.com` with that domain.

## Request example

```bash cURL theme={null}
export ONA_HOST=https://app.ona.com
export ONA_API_KEY=<your-token>

curl --request POST \
  --url "$ONA_HOST/api/gitpod.v1.EnvironmentService/MarkEnvironmentActive" \
  --header "Authorization: Bearer $ONA_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
  "environmentId": "<environment-id>"
}'
```

```python Python theme={null}
import gitpod.v1.environment_pb2 as environment_pb2
from ona_sdk import create_client_from_env

ona = create_client_from_env()
request = environment_pb2.MarkEnvironmentActiveRequest(
    environment_id="<environment-id>",
)
response = ona.services.environment.mark_environment_active(request)
print(response)
```

```typescript TypeScript theme={null}
import { create } from "@bufbuild/protobuf";
import { createClientFromEnv } from "@gitpod/sdk";
import { MarkEnvironmentActiveRequestSchema } from "@gitpod/sdk/gitpod/v1/environment_pb";

async function main() {
  const ona = createClientFromEnv();
  const request = create(MarkEnvironmentActiveRequestSchema, {
    environmentId: "<environment-id>",
  });
  const response = await ona.services.environment.markEnvironmentActive(request);
  console.log(response);
}

main().catch(console.error);
```

```go Go theme={null}
package main

import (
	"context"
	"fmt"
	"log"

	"connectrpc.com/connect"
	"github.com/gitpod-io/gitpod-sdk-go/sdk"
	gitpodpb "github.com/gitpod-io/gitpod-sdk-go/v1"
)

func main() {
	ona, err := sdk.NewFromEnv()
	if err != nil {
		log.Fatal(err)
	}

	request := connect.NewRequest(&gitpodpb.MarkEnvironmentActiveRequest{
		EnvironmentId: "<environment-id>",
	})
	response, err := ona.Services.Environment.MarkEnvironmentActive(context.Background(), request)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(response.Msg)
}
```

```json Request body theme={null}
{
  "environmentId": "<environment-id>"
}
```

## Request

`gitpod.v1.MarkEnvironmentActiveRequest`

| Field | Type | Required | Description |
| - | - | - | - |
| `environmentId` | string | No | The ID of the environment to update activity for. Constraints: `string.uuid=true`. |
| `activitySignal` | [EnvironmentActivitySignal](#type-gitpod-v1-environment-activity-signal) | No | activity\_signal specifies the activity. |

## Response

`gitpod.v1.MarkEnvironmentActiveResponse`

This message has no fields.

## Related types

> [accordion] EnvironmentActivitySignal
>
> EnvironmentActivitySignal used to signal activity for an environment.
>
> `gitpod.v1.EnvironmentActivitySignal`
>
> | Field | Type | Required | Description |
> | - | - | - | - |
> | `source` | string | No | source of the activity signal, such as "VS Code", "SSH", or "Automations". It should be a human-readable string that describes the source of the activity signal. Constraints: `string.max_len=80, string.min_len=3`. |
> | `timestamp` | RFC 3339 timestamp | No | timestamp of when the activity was observed by the source. Only reported every 5 minutes. Zero value means no activity was observed. |


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